asp.net - setting a commandname in gridview buttonfield -


i have button in rows in gridview , when clicking button code behind handles button click. want pass commandname paramater through each button click, order id. i'm wondering how can set commmand name each button.

                    <columns>                         <asp:boundfield datafield="status" headertext="status" headerstyle-horizontalalign="left" sortexpression="status" />                         <asp:boundfield datafield="orderid" headertext="order id" headerstyle-horizontalalign="left" sortexpression="orderid" />                         <asp:boundfield datafield="customer" headertext="customer" headerstyle-horizontalalign="left" sortexpression="customer" />                         <asp:boundfield datafield="email" headertext="email" headerstyle-horizontalalign="left" sortexpression="email" />                         <asp:boundfield datafield="createddate" headertext="created date" headerstyle-horizontalalign="left" sortexpression="createddate" />                         <asp:boundfield datafield="promocode" headertext="promo code" headerstyle-horizontalalign="left" sortexpression="promocode" />                         <asp:boundfield datafield="grandtotal" headertext="grand total" headerstyle-horizontalalign="left" sortexpression="grandtotal" dataformatstring="{0:c}"/>                         <asp:buttonfield text="view" commandname="6182" buttontype="button"  />                      </columns> 

as can see abve last column button appears on each row , i've set 6182 - example. want set orderid value...

how can that?

thanks,

i'd go similar this:

<asp:buttonfield text="view" commandname='<%# eval("orderid") %>' buttontype="button"  /> 

that should insert orderid bound row field. if doesn't work, convert column templatefield, add button , same. report :-)


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -