Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

VisualWebpart - controls like radiobuttonlist and dropdownlist not firing the SelectedIndexChanged event when inside a repeater datarow.

Any help?

Source code:

Site URL                   HyperLink     Admins     1 2 The following are identified as the child sites of the above site, please select the appropriate properties next to it.     Inherit Parent Site Do-not Inherit Parent Site Select EMEA LTAM --%>      

using System; using System.ComponentModel; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Microsoft.SharePoint; using Microsoft.SharePoint.WebControls; using System.Data;

namespace DeriveMigrationData.DeriveSiteAdminForm { [ToolboxItem(false)] public partial class DeriveSiteAdminForm : System.Web.UI.WebControls.WebParts.WebPart { protected override void OnInit(EventArgs e) { base.OnInit(e); InitializeControl(); }

    DataTable dt;
    protected void Page_Load(object sender, EventArgs e)
    {

        string siteurl; string admins;

        int itemid = SPContext.Current.ItemId;

        dt = BLL.SiteAdminData.GetAdminsData(SPContext.Current.Web.CurrentUser.LoginName, SPContext.Current.ListId);
        BLL.SiteAdminData.GetCurrentItem(dt, itemid, out siteurl, out admins);
        HyperLink1.NavigateUrl = siteurl;
        HyperLink1.Text = siteurl;
        string[] adm = admins.Split(';');
        RadioButtonList1.DataSource = BLL.SiteAdminData.getResolvedUsers(adm, SPContext.Current.Web);
        //RadioButtonList1.DataSource = adm;
        RadioButtonList1.DataTextField = "Name";
        RadioButtonList1.DataValueField = "LoginName";
        RadioButtonList1.DataBind();
        BindChildSites(dt, siteurl);

    }

    private void BindChildSites(DataTable dt, string siteurl)
    {

        RpChildSites.DataSource = BLL.SiteAdminData.GetAdminsSiteChilds(dt, siteurl);
        RpChildSites.DataBind();

        //GridView1.DataSource = RpChildSites.DataSource;
        //GridView1.AutoGenerateColumns = true;
        //GridView1.DataBind();
    }

    protected void RBinheritParent_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (((RadioButtonList)sender).SelectedValue.Equals("Inherit"))
        {
            //showthe current row prop
        }

    }

    protected void RpChildSites_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
       ControlCollection c = (ControlCollection)RpChildSites.Controls;
    }

    protected void DDRegion_SelectedIndexChanged(object sender, EventArgs e)
    {
        //triggers on the region change, load other data
    }

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        //test
    }




}

}

share|improve this question
add comment

2 Answers 2

Both of the controls you mention have the autopostback property set to false as default. I can not see that you set autopostback to true in your code. So if you are not doing that in your markup either, be sure to set that property and your selectindexchanged should be triggered.

share|improve this answer
add comment

You could try to handle the event "ItemDataBound" of the repeater. In the EventHandler you can get the control with e.Item.FindControl("ControlID") and then attache your event here.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.