update database from gridview having dropdownlist Asp.net -
webpage:
i have gridview , have 5 dropdownlist on it, mentioned below. first column normal boundfield (client list) , rest dropdownlist (contains userid) , default value on dropdownlist "select user".
database:
first column has clientname , rest 5 columns null.
on button click want to:
1) update rows database user have made changes (any dropdownlist in row) on form particular client.
2) , if there userid present in database client should selected on dropdownlist on form.
<asp:gridview id="gridview" runat="server" autogeneratecolumns="false" onrowdatabound="gridview_rowdatabound"> <columns> <asp:boundfield datafield="name" headertext="name" /> <asp:templatefield headertext="csm"> <itemtemplate> <asp:dropdownlist datasource= '<%# getcsm()%>' datatextfield="userid" datavaluefield="userid" id ="csm" runat="server" font-size="smaller" appenddatabounditems="true"> <asp:listitem selected="true" text="select user" value="default value" /> </asp:dropdownlist> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="sr manager csm"> <itemtemplate> <asp:dropdownlist datasource= '<%# getsrcsm()%>' datatextfield="userid" datavaluefield="userid" id ="srcsm" runat="server" font-size="smaller" appenddatabounditems="true"> <asp:listitem selected="true" text="select user" value="default value" /> </asp:dropdownlist> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="de"> <itemtemplate> <asp:dropdownlist datasource= '<%# getde()%>' datatextfield="userid" datavaluefield="userid" id ="de" runat="server" font-size="smaller" appenddatabounditems="true"> <asp:listitem selected="true" text="select user" value="default value" /> </asp:dropdownlist> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="ae"> <itemtemplate> <asp:dropdownlist datasource= '<%# getae()%>' datatextfield="userid" datavaluefield="userid" id ="ae" runat="server" font-size="smaller" appenddatabounditems="true"> <asp:listitem selected="true" text="select user" value="default value" /> </asp:dropdownlist> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="te"> <itemtemplate> <asp:dropdownlist datasource= '<%# gette()%>' datatextfield="userid" datavaluefield="userid" id ="te" runat="server" font-size="smaller" appenddatabounditems="true"> <asp:listitem selected="true" text="select user" value="default value" /> </asp:dropdownlist> </itemtemplate> </asp:templatefield> </columns> </asp:gridview>
is there anyway can use edit , save button on each row. how can achieve this. in advance.
Comments
Post a Comment