bind dropdownlist in repeater asp.net

Easy you set drop down list datasourse in repeater

1- Create ItemDataBound event
2- Check ListItemType one by one
3- Find dropdown which you take on repeater
4- DataSource

protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            try
            {
                if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
                {
                    DropDownList ddl = (DropDownList)e.Item.FindControl("ddlAbc");
                    DataTable dt = GetDataSource();
                    ddl.DataSource = lstReferencePoint;
                    ddl.DataValueField = "ID";
                    ddl.DataTextField = "Name";
                    ddl.DataBind();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }

Comments

Popular posts from this blog

Add Image through base64 on PDF in itextsharp

Set span value using jquery and javascript

how to insert text and tags at the cursor CKEDITOR