LinkButton returns an error "_ doPostBack ('...... ',') "The object is missing

Source: Internet
Author: User

Today, I found a very deep hidden Bug. I checked the motion information on the Agenda page and closed it. When it was disabled, an error was reported, "the object is missing" _ doPostBack, at the beginning, I used the system's close button, that is, the X button, so I suspected it was a button problem, after checking the front-end code, we found that the missing object is GridSubject, that is, the URL of href in the parent page list is _ doPostBack ('............ ''') The first parameter is the same as the error page, so I found the cause, because the LinkButton is used for backend connection. I tried to determine whether the first parameter of PostBack exists, there is no way to do this (maybe there is, I did not find it). When I was looking for it, I found that MSDN recommended using the HyperLink proxy LinkButton, and found it very good, without the href attribute, there is no _ doPostBack. After testing, no error is found. Unfortunately, the style is no longer covered by the topic, and text-decoration: underline is used to solve the problem. It seems that the solution is complete. I am afraid that the page cannot be refreshed when it is closed. It is a test and cannot be refreshed.

 

 

Final Solution

Method:

The background code is in RowDataBound.

TableCell tc = e. Row. Cells [1];

Tc. SetDisplayText (14 );

E. Row. Cells [1]. Controls. Clear ();

LinkButton link = new LinkButton ();

Link. Text = tc. Text;

Link. ToolTip = tc. ToolTip;

Link. Style. Value = "text-decoration: underline ;";

E. Row. Cells [1]. Controls. Add (link );

 

Link. Attributes ["onclick"] =

String. Format (@ "javascript: PopSub ('{0}', this );"

, E. Row. Cells [0]. Text

);

 

Front-end code:

Function PopSub (SubID, obj ){

Var Dom = Pop ('~ /Before/SubjectInfo. ascx | SubjectID = '+ SubID, null,

'Dialogwidth: 648px; dialogHeight: 655px; center: yes; help: no; resizeble: yes; scroll: yes; status: no ',

'Topic information ');

// The Dom that saves the topic information is not empty.

Var hrefStr = "javascript :__ doPostBack ('mypan $ ucView_myPan $ GridSubject $ ctl03 $ ctl01 ','')";

If (IsNull (Dom ))

{

Obj. removeAttribute ("href ");

/* Because neither the cyclic waste time method nor the Try method can be solved, I used the href Method for removal.

// Waste of time

Var I = 0;

Var strin = "";

While (I <100000)

{

Strin = "UU" + I;

I ++

}

If (I = 100000)

{

//

}

Try

{

Obj. setAttribute ("href", hrefStr, true );

}

Catch (e ){}

Return false;

*/

}

Else

{

Obj. setAttribute ("href", hrefStr, true );

}

}

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.