Using a control template in datagrid
<asp:templatecolumn headertext="columnheader">
<ItemTemplate>
<asp:label id="LabelName" runat="server" Text='<%# Container.dataitem("tempfield") %>'>
</asp>
</ItemTemplate>
<EditItemTemplate>
<asp:dropdownlist id="ddl1" runat="server" datavaluefield="Datavalue" datatextfield="DataDisplay" datasource="sqldatasource" >
</asp:dropdownlist>
</EditItemTemplate>
</asp:TemplateColumn>
the codebehind will look like this wherever you decide to put the code:
'declare variables to hold data
dim templist as DropDownList
dim tempdata as string
'assign the control as the control from the datagrid
templist = e.item.findcontrol("ddl1")
tempdata = templist.SelectedItem.Value
'if using sqldatasource assign the parameter
sqldatasource.updateparameter.item("data").defaultvalue = tempdata
Of course I haven't tested this yet but when I do I will make updates.
For a better understanding read the article by 4guysfromrolla at this link:
http://www.4guysfromrolla.com/webtech/050801-1.2.shtml
1 Comments:
My brother recommended I would possibly like this blog.
He was totally right. This put up truly made
my day. You can not consider simply how a lot time I had spent
for this information! Thanks!
my blog post :: modern outdoor furniture
By Anonymous, at 4/16/2013 9:37 PM
Post a Comment
<< Home