Ask a question and ask the experts to solve it.
I personally have more pages and I am not very familiar with the running mechanism. Now I have a problem to solve!
That is, I set an attribute on the page, but when the button submits an event, the breakpoint test found that the value is null.
I posted myCodePlease give me some advice.
Code
Public Int Productid
{
Get
{
Try { Return Int . Parse (request. querystring [ " ID " ]);}
Catch { Return 0 ;}
}
}
Public Int Productshopid = 0 ;
Public String Productname = "" ;
Public String Price = "" ;
Public String Makeregion = "" ;
Public String Productshopaddress = "" ;
Protected Void Imagebutton1_click ( Object Sender, imageclickeventargs E)
{
Corder order = New Corder ();
Sortedlist items = New Sortedlist ();
Items. Add ( " Ordershopid " , This . Currentshop. pkid );
Items. Add ( " Productshopid " , Productshopid );
Items. Add ( " Orderdate " , Datetime. Now. tostring ());
Items. Add ( " Productscount " , Txtcount. Text. Trim ());
String Address = "" ;
If (Dpdprovoince. selectedindex > 0 && Dpdcity. selectedindex > 0 && Txtaddress. Text ! = "" )
Address = String . Format ( " {0}-{1}-{2} " , Dpdprovoince. selecteditem. Text, dpdcity. selecteditem. Text, txtaddress. Text. Trim ());
Else
{
Label1.text = " Select and enter your address " ;
Return ;
}
Items. Add ( " Address " , Address );
Items. Add ( " Postcode " , Txtpostcode. Text. Trim ());
Items. Add ( " Receievename " , Txtrename. Text. Trim ());
Items. Add ( " Telephone " , Txttele. Text. Trim ());
Items. Add ( " Mobile " , Txtmobile. Text. Trim ());
Items. Add ( " Productid " , Productid );
If(Order. Add (items ))
Common. Alert ("Order published successfully");
}
I am not sure whyProductidThis attribute is null. Solve the problem. Thank you. Hurry up.