Summary of ASP. NET problems recently

Source: Internet
Author: User

1. If you want to control currentpage. index when binding a DataGrid, you must control currentpageindex before bindgrid.

2. Prevent pageindexnumber overflow after page turning. When querying after page turning, use currentpageindex = 0 to specify the number of displayed pages of the current DataGrid to prevent bugs.

3. When querying details, if you need to use another interface for modification, you need to pass three parameters. The first one is strsearch. The second is ID, and the third is pageindex. There must be a third one. for one purpose, make sure that, after turning pages, you can modify the pages and return to the original page number.

4. It is best to use the label on the search interface to store strsearch on the database.

5. the label length is automatically adjusted without human intervention. That is to say, when the output is output again, if the output result is not necessarily fixed length, you can use label instead of textbox. The length of textbox is not changed.

6. Problem:

"The file cannot be loaded in the Web Form Designer. Correct the following errors and re-load the unspecified errors." When you click the aspx file, the design form on this page cannot be displayed. The above prompt is displayed. Right-click to viewCodeThe code of the Aspx. CS file cannot be associated.

Solution:
1). Remove the aspx and code files from the project and then add them;

2) The project is read-only and the read-only is removed;

3). A third-party plug-in may be referenced on the page, but not in the reference.

4). The base class library is not added

7. Strange things

I remember that I met some strange things when I used Oracle last year. Sometimes I cannot tell it clearly. It may be a software problem or a computer problem, there is no way to come down to the RP issue. .

Use scratchpad of Oracle to write SQL statements, describe them using sequences, and insert data using insert statements. The strange results show that the sequence in the statements increases automatically, however, no results are displayed during the query. If the table name is changed, no result is returned. After changing the machine, the strange thing happened and it was displayed. So restart the PC and the result still exists. Other machines can run this SQL statement. Logout of the local machine does not work. Helpless, killer, shut down, wait for 10 minutes, the result appears, OK. This is the depressing thing. Relying on it, this fart problem wasted nearly two hours.

8. "The thread is being aborted"
In ASP. NETProgramIf the program code in the try block tries to force a page Jump, an exception "the thread is being aborted" will occur. To solve this problem, we need to remove the page Jump statement from the try block...
Indeed, this error will not occur if you write the transfer statement out of try. The first time I met this situation.

9. when the "button column" is used, when you click Edit and then click Update, the data in the DataGrid cannot be obtained, the possible cause is that the position of the bindgrid function in the page_load function is incorrect.

10. There is really no new technology, no new mistakes, no new breakthroughs.
Today, I tried to use the bindgrid () function to pass it using parameters. If no parameter exists, call the creattable () function to create the bound DataGrid. But the original function creation is like this.
Dataset DS = new dataset ();
Oledbdataadapter myadapter = new oledbdataadapter (strsearch_sj, myconn );
Myadapter. Fill (DS, "cj_2_zf_sj ");
Return Ds. Tables ["cj_2_zf_sj"]. defaultview;
If a parameter is added for calling, an if judgment is added. Because I use two judgment methods, I add two if judgments. But I never imagined that the error "Not all code paths return values" was reported ". It is suspected that the object is passed to the string object when the parameter is passed. This problem is not found after the online search. After the if statement is used, the program considers that there is no else end and an else is set up. The result is that there is no returned value, that is, after an else return is added, it will be OK.
The program reports an error "Not all code paths return values ".

11. Events bound to the DataGrid are inexplicably lost and depressing.
A good solution is to re-bind the time action in the code generated by the Form Designer.

12. I suddenly thought that the content in the dropdownlist can be selected, but it can also be edited like a testbox, so I can find relevant information online: The post is as follows:
< Input Type = "Text" Name = "Re_name" Style = "Font-size: 10pt; width: 100px; Height: 20px" > < Span Style = "Width: 18px" > < Select Style = "Margin-left:-100px; width: 118px; Background-color: # ffeeee" Onchange = "Document. All. re_name.value = This. value ;"
Name
= "R00" >
< Option Value = "AAA" Selected > Aaa Option >
< Option Value = "BBB" > Bbb Option >
< Option Value = "CCC" > CCC Option >
< Option Value = "DDD" > Ddd Option >
< Option Value = "Eee" > Eee Option>
Select>
Span>

Let's keep a souvenir. If you have a good idea, let's do it now.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.