Hi @Gani_tpt,
Try the following code:
protected void OnRowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Footer)
{
DropDownList DropDownList1 = (e.Row.FindControl("ddlcustomer") as DropDownList);
List<Item> items = new List<Item>();
items.Add(new Item() { Value= "1", Text = "USA" });
items.Add(new Item() { Value = "2", Text = "UK" });
items.Add(new Item() {Value = "3", Text = " AUS" });
items.Add(new Item() {Value = "4", Text = " OTHERS" });
DropDownList1.DataSource = items;
DropDownList1.DataTextField = "Text";
DropDownList1.DataValueField = "Value";
DropDownList1.DataBind();
DropDownList1.Items.Insert(0, new ListItem("--Select --", "0"));
}
}
public class Item
{
public Item() { }
public string Value { set; get; }
public string Text { set; get; }
}
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.