DataGrid / Mutually Exclusive

Discussion in 'ASP .Net Datagrid Control' started by g2, Aug 3, 2003.

  1. g2

    g2 Guest

    To my understanding it is not possible to have mutually exclusive radio
    button controls in a datagrid.
    (http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q316495). I have
    read that it is possible to just emit standard input radio tags in the
    itemtemplate column and the radio buttons should be mutually exclusive. I
    have tried the below but I still do not get mutually exclusive controls. Any
    ideas? Thanks.

    <asp:TemplateColumn>
    <ItemTemplate>
    <INPUT id="rbcust" type="radio" runat="server">
    </ItemTemplate>
    </asp:TemplateColumn>
    g2, Aug 3, 2003
    #1
    1. Advertising

  2. Try
    <asp:DataGrid id="DataGrid1" AutoGenerateColumns="False" runat="server">
    <Columns>
    <asp:TemplateColumn HeaderText="FirstName">
    <ItemTemplate>
    <input type="radio" name="optSelectedName" value=<%#DataBinder.Eval(Container.DataItem, "FirstName") %> onclick="javascript:txtFname.value = this.value;"><%#DataBinder.Eval(Container.DataItem, "FirstName") %>
    <br>
    </ItemTemplate>
    </asp:TemplateColumn>
    </Columns>
    </asp:DataGrid>
    <asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 154px; POSITION: absolute; TOP: 103px" runat="server" Text="Button"></asp:Button>
    <div style="VISIBILITY: hidden">
    <asp:TextBox ID="txtFname" Runat="server" />
    </div>

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    'Put user code to initialize the page here

    Dim myconnection As SqlConnection = New SqlConnection("server=localhost;uid=sa;password=;database=northwind")

    Dim myda As SqlDataAdapter = New SqlDataAdapter("Select * from Employees", myconnection)

    Dim ds As DataSet = New DataSet()

    myda.Fill(ds, "AllTables")

    DataGrid1.DataSource = ds

    DataGrid1.DataBind()

    End Sub



    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Response.Write ("You have selected :" & txtFname.Text)

    End Sub


    HTH
    Regards
    Sushila
    ..NET MVP

    "g2" <> wrote in message news:...
    > To my understanding it is not possible to have mutually exclusive radio
    > button controls in a datagrid.
    > (http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q316495). I have
    > read that it is possible to just emit standard input radio tags in the
    > itemtemplate column and the radio buttons should be mutually exclusive. I
    > have tried the below but I still do not get mutually exclusive controls. Any
    > ideas? Thanks.
    >
    > <asp:TemplateColumn>
    > <ItemTemplate>
    > <INPUT id="rbcust" type="radio" runat="server">
    > </ItemTemplate>
    > </asp:TemplateColumn>
    >
    >
    Sonali.NET[MVP], Aug 4, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ALuPin

    Mutually exclusive

    ALuPin, Sep 7, 2004, in forum: VHDL
    Replies:
    2
    Views:
    709
    Mike Treseler
    Sep 7, 2004
  2. js
    Replies:
    2
    Views:
    886
  3. Stimp
    Replies:
    2
    Views:
    799
    Stimp
    Oct 24, 2005
  4. Stimp
    Replies:
    5
    Views:
    5,973
    Greg Burns
    Nov 8, 2005
  5. xonet
    Replies:
    2
    Views:
    193
    Jan Hyde
    Jun 14, 2006
Loading...

Share This Page