I have a dropdown list control Gridwu controls are connected to the grid view control and drop a data source.
On the submit, the dropdown control only takes the value of the first index.
Here's ASPX code:
and & Lt; Columns & gt; & Lt; ASP: BoundfieldDIFF field = "qID" header text = "QID" /> & Lt; Asp: boundfield datfilled = "question" header text = "question" /> & Lt; Asp: TemplateField Header Text = "Feedback" & gt; & Lt; ItemTemplate & gt; & Lt; asp: DropDownList ID = "ddlResponse" runat = "server" AppendDataBoundItems = "True" AutoPostBack = "false" DataSourceID = "ResponseSDS" Detatekstfild = "response" DataValueField = "responseID" CssClass = "ddlStyle" on-selected index change = "DdlResponse_SelectedIndexChanged" & gt; & Lt;% - & lt; Asp: ListItem enabled = "True" selected = "false" & gt; & Lt; - Selected price - & gt; & Lt; / Asp: ListItem & gt; -% & gt; & Lt; / ASP: DropDownList & gt; & Lt; asp: SqlDataSource ID = "Rispanssdis" Rnat = "server" connection string = "& lt;% $ Knekshnstings: Acsieliyrshipsrwai connection string% & gt;" SelectCommand = "SELECT * FROM [tblResponse]" & gt; & Lt; / Asp: SqlDataSource & gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: TemplateField & gt; & Lt; / Column & gt; & Lt; EditRowStyle BackColor = "# 2461BF" /> & Lt; FooterStyle BackColor = "# 0085C 9" font-bold = "true" ForeColor = "white" /> & Lt; HeaderStyle BackColor = "# 0085C9" font-bold = "true" ForeColor = "white" /> & Lt; PagerStyle BackColor = "# 2461BF" ForeColor = "White" Horizontal Alliance = "Center" /> & Lt; RowStyle BackColor = "#EFF3FB" /> & Lt; Selected light BackAcllor = "# D1 ddf1" font-bold = "true" foreclosure = "# 333333" /> & Lt; Sorted spacecale style backcare = "# F5F7FB" /> & Lt; Sorted Header Style Style BackAcllor = "# 6D95E1" /> & Lt; Sorted Sending Sextile BackAclar = "# E9 EBFF" /> & Lt; Sorted Decking Header System Back Backlor = "# 4870 BE" /> & Lt; / ASP: GridView & gt; And here button click event behind code:
protected void btnSubmit_Click (object sender, EventArgs e) {// Question foreach (Live in gridwururu masterdata. Rao) {qID = int.Parse (MasterData.Cells [0]. Lesson); // qID = (int) gv question. DataKeys [(masterData.RowIndex)]. Values; // response = ((dropdown list) masterData.FindControl ("ddlResponse")). Selected value. ToString (); Dropdown List DDL = (Dropdown List) Live Quest Rouge [qid] .FundControl ("DDLRPS"); Responses = DDL Selected value Toasting (); }}
button click event has started a postback to drop Daunsuchi value For the default first index, keep in mind that the Page_Load event will be preceded by your button click event.
Comments
Post a Comment