I want bind data to dropdownlist in edittamplate in grid view [Resolved]

Posted by Ramaniranjanit-15272 under ASP.NET on 4/26/2012 | Points: 10 | Views : 3642 | Status : [Member] | Replies : 2
I attach my file
when debug that file
i got that error
System.ArgumentOutOfRangeException: 'ddltravelby' has a SelectedValue which is invalid because it does not exist in the list of items




Responses

Posted by: Oswaldlily on: 4/26/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
protected void ddl1_Load(object sender, EventArgs e)
{
DropDownList ddl=(DropDownList)sender;
ddl.DataSource = (...call yur values here...)
ddl.DataValueField = "Column name ";
ddl.DataBind();
}


<asp:DropDownList ID="ddlOrderType" runat="server" Onload="ddl1_load()">

</asp:DropDownList>

Ramaniranjanit-15272, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Veerac85 on: 4/30/2012 [Member] Starter | Points: 25

Up
0
Down
you could refer to this link for complete step-by-step instructions on doing this.
http://technico.qnownow.com/2012/04/05/use-dropdownlist-in-asp-net-gridview-control/

Ramaniranjanit-15272, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response