www.webdeveloper.com
Results 1 to 6 of 6

Thread: DataGrid

  1. #1
    Join Date
    Nov 2003
    Posts
    39

    DataGrid

    Hi,

    I created a datagrid (see code below) to display records from my backend database and also add a radio button using the template column tag. Here’s my problem, how do I programmatically know which radio button was click and pass the primary key value to another call method for further processing, on click of a button which is outside the datagrid control


    <asp:datagrid id="dgCustomer" runat="server" Width="100%" CellPadding="3" BorderColor="#999999"
    BackColor="White" BorderWidth="1px" BorderStyle="None" AutoGenerateColumns="False" HorizontalAlign="Center"
    GridLines="None" Visible="False">
    <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#008A8C>
    <Columns>
    <asp:TemplateColumn HeaderText="SL No.">
    <ItemTemplate>
    <asp:RadioButton ID="optSL" Runat="server"></asp:RadioButton>
    </ItemTemplate>
    </asp:TemplateColumn>
    <asp:BoundColumn DataField="traref" HeaderText="Tran Ref No"></asp:BoundColumn>
    <asp:BoundColumn DataField="tragrp" HeaderText="Product"></asp:BoundColumn>
    <asp:BoundColumn DataField="valdat"HeaderText="ValueDate"DataFormatString="{0:d}"></asp:BoundColumn>
    <asp:BoundColumn DataField="nomamt" HeaderText="Deal Amount" DataFormatString="{0:###,###,###,###}"></asp:BoundColumn>
    <asp:BoundColumn DataField="monrat" HeaderText="Rates" DataFormatString="{0:##.##}"></asp:BoundColumn>

    </Columns>
    </asp:datagrid>

  2. #2
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,224
    I have never mixed the data grid and radio buttons. Basically I am a man for the repeaster. What I would do it write out an html form in the repeater but incriment a vlaue in the id of each radio button. For example, write out the data sets row, or the incrimenting data base feild as the id of the repeater, then when a command button or whatever resends the form you can request it. Its the manual way of doing it, but it gives you some more control over what you are doing.

  3. #3
    Join Date
    Nov 2003
    Posts
    39

    datagrid

    thanx but i got something better

    http://www.datagridgirl.com/customcolumns.aspx
    but am having issues with the tagprefix using vb.net

  4. #4
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,224

    Re: datagrid

    Originally posted by chuxs
    thanx but i got something better

    http://www.datagridgirl.com/customcolumns.aspx
    but am having issues with the tagprefix using vb.net
    Its still a data grid. Data grids will also be rigid and not give you total control or freedom. I prefer the repeater because you can output results into any container you want (not just a table) and you can use the values rather then display them, etc.

  5. #5
    Join Date
    Nov 2003
    Posts
    39

    datagrid

    can i see some examples?

  6. #6
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,224

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles