Ask a question and ask the experts to solve it.

Source: Internet
Author: User

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.

 

 

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.