Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have a radio button list in the gridview and i am trying to retrieve the value
this is how i retrieve
VB
Dim btn As Button = DirectCast(sender, Button)
       'Get reference of the gridview row of the button clicked.
       Dim GridView2 As GridViewRow = DirectCast(btn.Parent.Parent, GridViewRow)
       Dim rbList As RadioButtonList = DirectCast(GridView1.Cells(2).FindControl("radioButtonList1"), RadioButtonList)

when i show in the gridview i am able to show only dd/mm/yyyy the value in the radio button list, when i MsgBox(rbList.Text) or MsgBox(rbList.SelectedValue)
it will show me a the date with the time as well
and when i insert the date value is not the same or not even't any of the radio button list value


but in my database the date field, the data type i allocate as date
ASP.NET
<asp:TemplateField HeaderText="Date">
                <ItemTemplate>
                    <table style="width:100%;">
                        <tr>
                            <td align="justify">
                                <asp:RadioButtonList ID="radioButtonList1" runat="server" AutoPostBack="True" 
                                    DataSourceID="SqlDataSource3" DataTextField="date" 
                                    DataTextFormatString="{0: d}" DataValueField="date" Height="30px" 
                                    Width="98px">
                                </asp:RadioButtonList>
                            </td>
                        </tr>
                    </table>
                               </asp:TemplateField>
Posted
Updated 29-Jan-12 9:02am
v2
Comments
beauxjames 5-Apr-12 17:28pm    
still vague on what you're actually asking...but my stab in the dark at a solution would be :: your date formatter should be {0:dd/MM/yyyy} ... however most people like the month first, so {0:MM/dd/yyyy}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900