Note that there are some explanatory texts on larger screens.

plurals
  1. POvalues not show in dropdownlist
    primarykey
    data
    text
    <p>i try to add values in dropdownlist in gridview query works fine but it appears as this .. <img src="https://i.stack.imgur.com/CwLSf.png" alt="enter image description here"></p> <p>gridview html</p> <pre><code>&lt;asp:BoundField HeaderText="ApproveID" DataField="ApproveID" &gt;&lt;/asp:BoundField&gt; &lt;asp:TemplateField&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="lblCountry" runat="server" Text='&lt;%# Eval("ApproveID") %&gt;' Visible = "false" /&gt; &lt;asp:DropDownList ID="DropDownList4" runat="server" class="vpb_dropdown"&gt; &lt;/asp:DropDownList&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; </code></pre> <p>code</p> <pre><code>protected void OnRowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //Find the DropDownList in the Row DropDownList ddlCountries = (e.Row.FindControl("DropDownList4") as DropDownList); ddlCountries.DataSource = GetData("SELECT ApproveID,ApproveType FROM ApproveType"); ddlCountries.DataTextField = "ApproveType"; ddlCountries.DataValueField = "ApproveID"; ddlCountries.DataBind(); //Add Default Item in the DropDownList ddlCountries.Items.Insert(0, new ListItem("Please select")); //Select the Country of Customer in DropDownList //string country = (e.Row.FindControl("lblCountry") as Label).Text; //ddlCountries.Items.FindByValue(country).Selected = true; } } </code></pre> <p>values are not inside in dropdownlist ..how to show values in dropdown?? and when i debug the code it cant show me any error </p> <p>getdata code</p> <pre><code>private DataSet GetData(string query) { string conString = ConfigurationManager.ConnectionStrings["mydms"].ConnectionString; SqlCommand cmd = new SqlCommand(query); using (SqlConnection con = new SqlConnection(conString)) { using (SqlDataAdapter sda = new SqlDataAdapter()) { cmd.Connection = con; sda.SelectCommand = cmd; using (DataSet ds = new DataSet()) { sda.Fill(ds); return ds; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload