Professional Web Applications Themes

RadioButtonList In A DataGrid Cell - Can I find the selected button without editing the cell? - ASP.NET Data Grid Control

I have an ASP.NET form with a DataGrid and Button. I want to put a RadioButtonList in a DataGrid cell. I bind it to an ArrayList which has a ListItem in the cell. The display part works fine. I then check some boxes and hit the submit button. I can't seem to get the value that is selected on the RadioButton List. I don't want to use the EditTemplate thing I just want to click on the radiobutton and submit the form. I also don't want to do autopostbacks when I click on a button. Can this be done? I ...

  1. #1

    Default RadioButtonList In A DataGrid Cell - Can I find the selected button without editing the cell?

    I have an ASP.NET form with a DataGrid and Button. I want to put a
    RadioButtonList in a DataGrid cell. I bind it to an ArrayList which has a
    ListItem in the cell. The display part works fine. I then check some boxes
    and hit the submit button. I can't seem to get the value that is selected on
    the RadioButton List. I don't want to use the EditTemplate thing I just want
    to click on the radiobutton and submit the form. I also don't want to do
    autopostbacks when I click on a button. Can this be done?

    I looked at this link:
    [url]http://support.microsoft.com/default.aspx?scid=kb;en-us;320707[/url]

    I modified the code to work with a RadioButton List not just a RadioButton.
    However from each RadioButton List when I cycle throug the GridItems it
    tells me that one of the buttons in the list was selected but I can't seem
    to get which one.

    Here is my test:

    using System;

    using System.Text;

    using System.Collections;

    using System.ComponentModel;

    using System.Data;

    using System.Drawing;

    using System.Web;

    using System.Web.SessionState;

    using System.Web.UI;

    using System.Web.UI.WebControls;

    using System.Web.UI.HtmlControls;

    namespace DataGridRadio

    {

    public class GridList

    {

    //Constructors

    public GridList() {}

    public GridList(

    string description,

    ArrayList bValue)

    {

    this.Description = description;

    this.BValue = bValue;

    }

    //Properties

    private string description;

    private ArrayList bValue;

    public string Description

    {

    get {return description;}

    set {description = value;}

    }

    public ArrayList BValue

    {

    get {return bValue;}

    set {bValue = value;}

    }

    }

    public class WebForm1 : System.Web.UI.Page

    {

    protected System.Web.UI.WebControls.DataGrid DataGrid1;

    protected System.Web.UI.WebControls.Label Message;

    protected System.Web.UI.WebControls.Button Button1;


    private void Page_Load(object sender, System.EventArgs e)

    {

    ArrayList blist1 = new ArrayList();

    ListItem li1 = new ListItem("aaa", "111");

    blist1.Add(li1);

    ListItem li2 = new ListItem("bbb", "222");

    blist1.Add(li2);

    ListItem li3 = new ListItem("ccc", "333");

    blist1.Add(li3);


    ArrayList blist2 = new ArrayList();

    ListItem li4 = new ListItem("ddd");

    blist2.Add(li4);

    ListItem li5 = new ListItem("eee");

    blist2.Add(li5);

    ListItem li6 = new ListItem("fff");

    blist2.Add(li6);

    ArrayList blist3 = new ArrayList();

    ListItem li7 = new ListItem("ggg");

    blist3.Add(li7);

    ListItem li8 = new ListItem("hhh");

    blist3.Add(li8);

    ListItem li9 = new ListItem("iii");

    blist3.Add(li9);



    ArrayList alist1 = new ArrayList();

    GridList gl1 = new GridList("aaaaaaaaaaa", blist1);

    alist1.Add(gl1);

    GridList gl2 = new GridList("bbbbbbbbbbb", blist2);

    alist1.Add(gl2);

    GridList gl3 = new GridList("ccccccccccc", blist3);

    alist1.Add(gl3);

    DataGrid1.DataSource = alist1;

    DataGrid1.DataBind();

    }

    #region Web Form Designer generated code

    override protected void OnInit(EventArgs e)

    {

    //

    // CODEGEN: This call is required by the ASP.NET Web Form Designer.

    //

    InitializeComponent();

    base.OnInit(e);

    }


    /// <summary>

    /// Required method for Designer support - do not modify

    /// the contents of this method with the code editor.

    /// </summary>

    private void InitializeComponent()

    {

    this.Button1.Click += new System.EventHandler(this.Button1_Click);

    this.Load += new System.EventHandler(this.Page_Load);

    }

    #endregion

    private void Button1_Click(object sender, System.EventArgs e)

    {

    StringBuilder gridSelections = new StringBuilder();

    //Loop through each DataGridItem, and determine which CheckBox controls

    //have been selected.

    foreach(DataGridItem DemoGridItem in DataGrid1.Items)

    {

    RadioButtonList myRadioButtonList =

    (RadioButtonList)DemoGridItem.Cells[1].Controls[1];

    bool b4 = myRadioButtonList.Items[1].Selected;

    int b1;

    b1 = myRadioButtonList.SelectedIndex;

    ListItem b2 = new ListItem();

    b2 = myRadioButtonList.SelectedItem;

    int b3 = 2;

    }

    }

    }

    }














    Empire City Guest

  2. #2

    Default Re: RadioButtonList In A DataGrid Cell - Can I find the selected button without editing the cell?

    RadioButtinlist has the following properties:

    SelectedItem,

    SelectedValue,

    SelectedIndex

    You can use these properties.

    Bye

    Michael

    "Empire City" <ab.com> wrote in message
    news:uq%jc.30263$mX.10902882twister.nyc.rr.com...
    > I have an ASP.NET form with a DataGrid and Button. I want to put a
    > RadioButtonList in a DataGrid cell. I bind it to an ArrayList which has a
    > ListItem in the cell. The display part works fine. I then check some boxes
    > and hit the submit button. I can't seem to get the value that is selected
    on
    > the RadioButton List. I don't want to use the EditTemplate thing I just
    want
    > to click on the radiobutton and submit the form. I also don't want to do
    > autopostbacks when I click on a button. Can this be done?
    >
    > I looked at this link:
    > [url]http://support.microsoft.com/default.aspx?scid=kb;en-us;320707[/url]
    >
    > I modified the code to work with a RadioButton List not just a
    RadioButton.
    > However from each RadioButton List when I cycle throug the GridItems it
    > tells me that one of the buttons in the list was selected but I can't seem
    > to get which one.
    >
    > Here is my test:
    >
    > using System;
    >
    > using System.Text;
    >
    > using System.Collections;
    >
    > using System.ComponentModel;
    >
    > using System.Data;
    >
    > using System.Drawing;
    >
    > using System.Web;
    >
    > using System.Web.SessionState;
    >
    > using System.Web.UI;
    >
    > using System.Web.UI.WebControls;
    >
    > using System.Web.UI.HtmlControls;
    >
    > namespace DataGridRadio
    >
    > {
    >
    > public class GridList
    >
    > {
    >
    > //Constructors
    >
    > public GridList() {}
    >
    > public GridList(
    >
    > string description,
    >
    > ArrayList bValue)
    >
    > {
    >
    > this.Description = description;
    >
    > this.BValue = bValue;
    >
    > }
    >
    > //Properties
    >
    > private string description;
    >
    > private ArrayList bValue;
    >
    > public string Description
    >
    > {
    >
    > get {return description;}
    >
    > set {description = value;}
    >
    > }
    >
    > public ArrayList BValue
    >
    > {
    >
    > get {return bValue;}
    >
    > set {bValue = value;}
    >
    > }
    >
    > }
    >
    > public class WebForm1 : System.Web.UI.Page
    >
    > {
    >
    > protected System.Web.UI.WebControls.DataGrid DataGrid1;
    >
    > protected System.Web.UI.WebControls.Label Message;
    >
    > protected System.Web.UI.WebControls.Button Button1;
    >
    >
    > private void Page_Load(object sender, System.EventArgs e)
    >
    > {
    >
    > ArrayList blist1 = new ArrayList();
    >
    > ListItem li1 = new ListItem("aaa", "111");
    >
    > blist1.Add(li1);
    >
    > ListItem li2 = new ListItem("bbb", "222");
    >
    > blist1.Add(li2);
    >
    > ListItem li3 = new ListItem("ccc", "333");
    >
    > blist1.Add(li3);
    >
    >
    > ArrayList blist2 = new ArrayList();
    >
    > ListItem li4 = new ListItem("ddd");
    >
    > blist2.Add(li4);
    >
    > ListItem li5 = new ListItem("eee");
    >
    > blist2.Add(li5);
    >
    > ListItem li6 = new ListItem("fff");
    >
    > blist2.Add(li6);
    >
    > ArrayList blist3 = new ArrayList();
    >
    > ListItem li7 = new ListItem("ggg");
    >
    > blist3.Add(li7);
    >
    > ListItem li8 = new ListItem("hhh");
    >
    > blist3.Add(li8);
    >
    > ListItem li9 = new ListItem("iii");
    >
    > blist3.Add(li9);
    >
    >
    >
    > ArrayList alist1 = new ArrayList();
    >
    > GridList gl1 = new GridList("aaaaaaaaaaa", blist1);
    >
    > alist1.Add(gl1);
    >
    > GridList gl2 = new GridList("bbbbbbbbbbb", blist2);
    >
    > alist1.Add(gl2);
    >
    > GridList gl3 = new GridList("ccccccccccc", blist3);
    >
    > alist1.Add(gl3);
    >
    > DataGrid1.DataSource = alist1;
    >
    > DataGrid1.DataBind();
    >
    > }
    >
    > #region Web Form Designer generated code
    >
    > override protected void OnInit(EventArgs e)
    >
    > {
    >
    > //
    >
    > // CODEGEN: This call is required by the ASP.NET Web Form Designer.
    >
    > //
    >
    > InitializeComponent();
    >
    > base.OnInit(e);
    >
    > }
    >
    >
    > /// <summary>
    >
    > /// Required method for Designer support - do not modify
    >
    > /// the contents of this method with the code editor.
    >
    > /// </summary>
    >
    > private void InitializeComponent()
    >
    > {
    >
    > this.Button1.Click += new System.EventHandler(this.Button1_Click);
    >
    > this.Load += new System.EventHandler(this.Page_Load);
    >
    > }
    >
    > #endregion
    >
    > private void Button1_Click(object sender, System.EventArgs e)
    >
    > {
    >
    > StringBuilder gridSelections = new StringBuilder();
    >
    > //Loop through each DataGridItem, and determine which CheckBox controls
    >
    > //have been selected.
    >
    > foreach(DataGridItem DemoGridItem in DataGrid1.Items)
    >
    > {
    >
    > RadioButtonList myRadioButtonList =
    >
    > (RadioButtonList)DemoGridItem.Cells[1].Controls[1];
    >
    > bool b4 = myRadioButtonList.Items[1].Selected;
    >
    > int b1;
    >
    > b1 = myRadioButtonList.SelectedIndex;
    >
    > ListItem b2 = new ListItem();
    >
    > b2 = myRadioButtonList.SelectedItem;
    >
    > int b3 = 2;
    >
    > }
    >
    > }
    >
    > }
    >
    > }
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >

    Michael Tkachev Guest

  3. #3

    Default Re: RadioButtonList In A DataGrid Cell - Can I find the selected button without editing the cell?

    For some reason SelecteItem, etc. come up as nothing or null. If you look at
    the line in my code below
    > bool b4 = myRadioButtonList.Items[1].Selected;
    I tried all sorts of different settings and when it's in a DataGrid it only
    seems to return selected if one of the buttons in the list is selected.
    Trying all the suggested things below they all come back empty and I can't
    seem to get the SelectedItem. I've worked with RadioButtonLists a lot but
    not in the DataGrid.

    "Michael Tkachev" <m_tkachevhotmail.com> wrote in message
    news:unS$ycdLEHA.2148TK2MSFTNGP09.phx.gbl...
    > RadioButtinlist has the following properties:
    >
    > SelectedItem,
    >
    > SelectedValue,
    >
    > SelectedIndex
    >
    > You can use these properties.
    >
    > Bye
    >
    > Michael
    >
    > "Empire City" <ab.com> wrote in message
    > news:uq%jc.30263$mX.10902882twister.nyc.rr.com...
    > > I have an ASP.NET form with a DataGrid and Button. I want to put a
    > > RadioButtonList in a DataGrid cell. I bind it to an ArrayList which has
    a
    > > ListItem in the cell. The display part works fine. I then check some
    boxes
    > > and hit the submit button. I can't seem to get the value that is
    selected
    > on
    > > the RadioButton List. I don't want to use the EditTemplate thing I just
    > want
    > > to click on the radiobutton and submit the form. I also don't want to do
    > > autopostbacks when I click on a button. Can this be done?
    > >
    > > I looked at this link:
    > > [url]http://support.microsoft.com/default.aspx?scid=kb;en-us;320707[/url]
    > >
    > > I modified the code to work with a RadioButton List not just a
    > RadioButton.
    > > However from each RadioButton List when I cycle throug the GridItems it
    > > tells me that one of the buttons in the list was selected but I can't
    seem
    > > to get which one.
    > >
    > > Here is my test:
    > >
    > > using System;
    > >
    > > using System.Text;
    > >
    > > using System.Collections;
    > >
    > > using System.ComponentModel;
    > >
    > > using System.Data;
    > >
    > > using System.Drawing;
    > >
    > > using System.Web;
    > >
    > > using System.Web.SessionState;
    > >
    > > using System.Web.UI;
    > >
    > > using System.Web.UI.WebControls;
    > >
    > > using System.Web.UI.HtmlControls;
    > >
    > > namespace DataGridRadio
    > >
    > > {
    > >
    > > public class GridList
    > >
    > > {
    > >
    > > //Constructors
    > >
    > > public GridList() {}
    > >
    > > public GridList(
    > >
    > > string description,
    > >
    > > ArrayList bValue)
    > >
    > > {
    > >
    > > this.Description = description;
    > >
    > > this.BValue = bValue;
    > >
    > > }
    > >
    > > //Properties
    > >
    > > private string description;
    > >
    > > private ArrayList bValue;
    > >
    > > public string Description
    > >
    > > {
    > >
    > > get {return description;}
    > >
    > > set {description = value;}
    > >
    > > }
    > >
    > > public ArrayList BValue
    > >
    > > {
    > >
    > > get {return bValue;}
    > >
    > > set {bValue = value;}
    > >
    > > }
    > >
    > > }
    > >
    > > public class WebForm1 : System.Web.UI.Page
    > >
    > > {
    > >
    > > protected System.Web.UI.WebControls.DataGrid DataGrid1;
    > >
    > > protected System.Web.UI.WebControls.Label Message;
    > >
    > > protected System.Web.UI.WebControls.Button Button1;
    > >
    > >
    > > private void Page_Load(object sender, System.EventArgs e)
    > >
    > > {
    > >
    > > ArrayList blist1 = new ArrayList();
    > >
    > > ListItem li1 = new ListItem("aaa", "111");
    > >
    > > blist1.Add(li1);
    > >
    > > ListItem li2 = new ListItem("bbb", "222");
    > >
    > > blist1.Add(li2);
    > >
    > > ListItem li3 = new ListItem("ccc", "333");
    > >
    > > blist1.Add(li3);
    > >
    > >
    > > ArrayList blist2 = new ArrayList();
    > >
    > > ListItem li4 = new ListItem("ddd");
    > >
    > > blist2.Add(li4);
    > >
    > > ListItem li5 = new ListItem("eee");
    > >
    > > blist2.Add(li5);
    > >
    > > ListItem li6 = new ListItem("fff");
    > >
    > > blist2.Add(li6);
    > >
    > > ArrayList blist3 = new ArrayList();
    > >
    > > ListItem li7 = new ListItem("ggg");
    > >
    > > blist3.Add(li7);
    > >
    > > ListItem li8 = new ListItem("hhh");
    > >
    > > blist3.Add(li8);
    > >
    > > ListItem li9 = new ListItem("iii");
    > >
    > > blist3.Add(li9);
    > >
    > >
    > >
    > > ArrayList alist1 = new ArrayList();
    > >
    > > GridList gl1 = new GridList("aaaaaaaaaaa", blist1);
    > >
    > > alist1.Add(gl1);
    > >
    > > GridList gl2 = new GridList("bbbbbbbbbbb", blist2);
    > >
    > > alist1.Add(gl2);
    > >
    > > GridList gl3 = new GridList("ccccccccccc", blist3);
    > >
    > > alist1.Add(gl3);
    > >
    > > DataGrid1.DataSource = alist1;
    > >
    > > DataGrid1.DataBind();
    > >
    > > }
    > >
    > > #region Web Form Designer generated code
    > >
    > > override protected void OnInit(EventArgs e)
    > >
    > > {
    > >
    > > //
    > >
    > > // CODEGEN: This call is required by the ASP.NET Web Form Designer.
    > >
    > > //
    > >
    > > InitializeComponent();
    > >
    > > base.OnInit(e);
    > >
    > > }
    > >
    > >
    > > /// <summary>
    > >
    > > /// Required method for Designer support - do not modify
    > >
    > > /// the contents of this method with the code editor.
    > >
    > > /// </summary>
    > >
    > > private void InitializeComponent()
    > >
    > > {
    > >
    > > this.Button1.Click += new System.EventHandler(this.Button1_Click);
    > >
    > > this.Load += new System.EventHandler(this.Page_Load);
    > >
    > > }
    > >
    > > #endregion
    > >
    > > private void Button1_Click(object sender, System.EventArgs e)
    > >
    > > {
    > >
    > > StringBuilder gridSelections = new StringBuilder();
    > >
    > > //Loop through each DataGridItem, and determine which CheckBox controls
    > >
    > > //have been selected.
    > >
    > > foreach(DataGridItem DemoGridItem in DataGrid1.Items)
    > >
    > > {
    > >
    > > RadioButtonList myRadioButtonList =
    > >
    > > (RadioButtonList)DemoGridItem.Cells[1].Controls[1];
    > >
    > > bool b4 = myRadioButtonList.Items[1].Selected;
    > >
    > > int b1;
    > >
    > > b1 = myRadioButtonList.SelectedIndex;
    > >
    > > ListItem b2 = new ListItem();
    > >
    > > b2 = myRadioButtonList.SelectedItem;
    > >
    > > int b3 = 2;
    > >
    > > }
    > >
    > > }
    > >
    > > }
    > >
    > > }
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    >
    >

    Empire City Guest

  4. #4

    Default Re: RadioButtonList In A DataGrid Cell - Can I find the selected button without editing the cell?

    Hi Michael

    Thanks for your help. A bit of persistance and I figured it out. I did not
    properly set the DataTextField and DataValueField properties of the
    RadioButtonList in the DataGrid item template. I looked at the source output
    and saw the value="" and that told me I need to set that.

    Thank you.



    "Empire City" <ab.com> wrote in message
    news:Th6kc.69712$WA4.54674twister.nyc.rr.com...
    > For some reason SelecteItem, etc. come up as nothing or null. If you look
    at
    > the line in my code below
    > > bool b4 = myRadioButtonList.Items[1].Selected;
    > I tried all sorts of different settings and when it's in a DataGrid it
    only
    > seems to return selected if one of the buttons in the list is selected.
    > Trying all the suggested things below they all come back empty and I can't
    > seem to get the SelectedItem. I've worked with RadioButtonLists a lot but
    > not in the DataGrid.
    >
    > "Michael Tkachev" <m_tkachevhotmail.com> wrote in message
    > news:unS$ycdLEHA.2148TK2MSFTNGP09.phx.gbl...
    > > RadioButtinlist has the following properties:
    > >
    > > SelectedItem,
    > >
    > > SelectedValue,
    > >
    > > SelectedIndex
    > >
    > > You can use these properties.
    > >
    > > Bye
    > >
    > > Michael
    > >
    > > "Empire City" <ab.com> wrote in message
    > > news:uq%jc.30263$mX.10902882twister.nyc.rr.com...
    > > > I have an ASP.NET form with a DataGrid and Button. I want to put a
    > > > RadioButtonList in a DataGrid cell. I bind it to an ArrayList which
    has
    > a
    > > > ListItem in the cell. The display part works fine. I then check some
    > boxes
    > > > and hit the submit button. I can't seem to get the value that is
    > selected
    > > on
    > > > the RadioButton List. I don't want to use the EditTemplate thing I
    just
    > > want
    > > > to click on the radiobutton and submit the form. I also don't want to
    do
    > > > autopostbacks when I click on a button. Can this be done?
    > > >
    > > > I looked at this link:
    > > > [url]http://support.microsoft.com/default.aspx?scid=kb;en-us;320707[/url]
    > > >
    > > > I modified the code to work with a RadioButton List not just a
    > > RadioButton.
    > > > However from each RadioButton List when I cycle throug the GridItems
    it
    > > > tells me that one of the buttons in the list was selected but I can't
    > seem
    > > > to get which one.
    > > >
    > > > Here is my test:
    > > >
    > > > using System;
    > > >
    > > > using System.Text;
    > > >
    > > > using System.Collections;
    > > >
    > > > using System.ComponentModel;
    > > >
    > > > using System.Data;
    > > >
    > > > using System.Drawing;
    > > >
    > > > using System.Web;
    > > >
    > > > using System.Web.SessionState;
    > > >
    > > > using System.Web.UI;
    > > >
    > > > using System.Web.UI.WebControls;
    > > >
    > > > using System.Web.UI.HtmlControls;
    > > >
    > > > namespace DataGridRadio
    > > >
    > > > {
    > > >
    > > > public class GridList
    > > >
    > > > {
    > > >
    > > > //Constructors
    > > >
    > > > public GridList() {}
    > > >
    > > > public GridList(
    > > >
    > > > string description,
    > > >
    > > > ArrayList bValue)
    > > >
    > > > {
    > > >
    > > > this.Description = description;
    > > >
    > > > this.BValue = bValue;
    > > >
    > > > }
    > > >
    > > > //Properties
    > > >
    > > > private string description;
    > > >
    > > > private ArrayList bValue;
    > > >
    > > > public string Description
    > > >
    > > > {
    > > >
    > > > get {return description;}
    > > >
    > > > set {description = value;}
    > > >
    > > > }
    > > >
    > > > public ArrayList BValue
    > > >
    > > > {
    > > >
    > > > get {return bValue;}
    > > >
    > > > set {bValue = value;}
    > > >
    > > > }
    > > >
    > > > }
    > > >
    > > > public class WebForm1 : System.Web.UI.Page
    > > >
    > > > {
    > > >
    > > > protected System.Web.UI.WebControls.DataGrid DataGrid1;
    > > >
    > > > protected System.Web.UI.WebControls.Label Message;
    > > >
    > > > protected System.Web.UI.WebControls.Button Button1;
    > > >
    > > >
    > > > private void Page_Load(object sender, System.EventArgs e)
    > > >
    > > > {
    > > >
    > > > ArrayList blist1 = new ArrayList();
    > > >
    > > > ListItem li1 = new ListItem("aaa", "111");
    > > >
    > > > blist1.Add(li1);
    > > >
    > > > ListItem li2 = new ListItem("bbb", "222");
    > > >
    > > > blist1.Add(li2);
    > > >
    > > > ListItem li3 = new ListItem("ccc", "333");
    > > >
    > > > blist1.Add(li3);
    > > >
    > > >
    > > > ArrayList blist2 = new ArrayList();
    > > >
    > > > ListItem li4 = new ListItem("ddd");
    > > >
    > > > blist2.Add(li4);
    > > >
    > > > ListItem li5 = new ListItem("eee");
    > > >
    > > > blist2.Add(li5);
    > > >
    > > > ListItem li6 = new ListItem("fff");
    > > >
    > > > blist2.Add(li6);
    > > >
    > > > ArrayList blist3 = new ArrayList();
    > > >
    > > > ListItem li7 = new ListItem("ggg");
    > > >
    > > > blist3.Add(li7);
    > > >
    > > > ListItem li8 = new ListItem("hhh");
    > > >
    > > > blist3.Add(li8);
    > > >
    > > > ListItem li9 = new ListItem("iii");
    > > >
    > > > blist3.Add(li9);
    > > >
    > > >
    > > >
    > > > ArrayList alist1 = new ArrayList();
    > > >
    > > > GridList gl1 = new GridList("aaaaaaaaaaa", blist1);
    > > >
    > > > alist1.Add(gl1);
    > > >
    > > > GridList gl2 = new GridList("bbbbbbbbbbb", blist2);
    > > >
    > > > alist1.Add(gl2);
    > > >
    > > > GridList gl3 = new GridList("ccccccccccc", blist3);
    > > >
    > > > alist1.Add(gl3);
    > > >
    > > > DataGrid1.DataSource = alist1;
    > > >
    > > > DataGrid1.DataBind();
    > > >
    > > > }
    > > >
    > > > #region Web Form Designer generated code
    > > >
    > > > override protected void OnInit(EventArgs e)
    > > >
    > > > {
    > > >
    > > > //
    > > >
    > > > // CODEGEN: This call is required by the ASP.NET Web Form Designer.
    > > >
    > > > //
    > > >
    > > > InitializeComponent();
    > > >
    > > > base.OnInit(e);
    > > >
    > > > }
    > > >
    > > >
    > > > /// <summary>
    > > >
    > > > /// Required method for Designer support - do not modify
    > > >
    > > > /// the contents of this method with the code editor.
    > > >
    > > > /// </summary>
    > > >
    > > > private void InitializeComponent()
    > > >
    > > > {
    > > >
    > > > this.Button1.Click += new System.EventHandler(this.Button1_Click);
    > > >
    > > > this.Load += new System.EventHandler(this.Page_Load);
    > > >
    > > > }
    > > >
    > > > #endregion
    > > >
    > > > private void Button1_Click(object sender, System.EventArgs e)
    > > >
    > > > {
    > > >
    > > > StringBuilder gridSelections = new StringBuilder();
    > > >
    > > > //Loop through each DataGridItem, and determine which CheckBox
    controls
    > > >
    > > > //have been selected.
    > > >
    > > > foreach(DataGridItem DemoGridItem in DataGrid1.Items)
    > > >
    > > > {
    > > >
    > > > RadioButtonList myRadioButtonList =
    > > >
    > > > (RadioButtonList)DemoGridItem.Cells[1].Controls[1];
    > > >
    > > > bool b4 = myRadioButtonList.Items[1].Selected;
    > > >
    > > > int b1;
    > > >
    > > > b1 = myRadioButtonList.SelectedIndex;
    > > >
    > > > ListItem b2 = new ListItem();
    > > >
    > > > b2 = myRadioButtonList.SelectedItem;
    > > >
    > > > int b3 = 2;
    > > >
    > > > }
    > > >
    > > > }
    > > >
    > > > }
    > > >
    > > > }
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > >
    > >
    >
    >

    Empire City Guest

Similar Threads

  1. DataGrid cell editing
    By Floating_point in forum Macromedia Flex General Discussion
    Replies: 3
    Last Post: August 5th, 07:12 PM
  2. dataGrid cell value unable to find
    By BryanWhite in forum Macromedia Flash Data Integration
    Replies: 0
    Last Post: March 12th, 06:47 PM
  3. Replies: 1
    Last Post: February 17th, 09:37 PM
  4. DataGrid Cell with Image Button In It
    By KJ in forum ASP.NET Data Grid Control
    Replies: 2
    Last Post: December 16th, 02:55 PM
  5. --- retrieving text from a selected datagrid cell ---
    By Daniel Bass in forum ASP.NET Data Grid Control
    Replies: 2
    Last Post: July 8th, 02:18 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139