Click here to Skip to main content
15,902,893 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have an query please ans me as fast as posible i need urgently
i have a grid view which contains some controls like radio button and text box. i want to save these details to their corresponding id of student in table attendance
i want to store the attendance detail of the student
html code is
==========================================================
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
BackColor="White" BorderColor="‪#‎CCCCCC‬" BorderStyle="None" BorderWidth="1px"
CellPadding="4" ForeColor="Black" GridLines="Horizontal">
<columns><asp:BoundField HeaderText="STUDENT ID" DataField="stud_id" >
<itemstyle horizontalalign="Center" verticalalign="Middle">

<asp:BoundField HeaderText="STUDENT NAME" DataField="stud_name" >
<itemstyle horizontalalign="Left">

<asp:TemplateField HeaderText="ATTENDANCE">
<itemtemplate>
<asp:RadioButton ID="rb_present" runat="server" Text="Present" GroupName="a" Checked="true"/>
<asp:RadioButton ID="rb_absent" runat="server" Text="Absent" GroupName="a"/>
<asp:RadioButton ID="rb_leave" runat="server" Text="Leave" GroupName="a"/>

<itemstyle width="200px">

<asp:TemplateField HeaderText="REMARK">
<itemtemplate>
<asp:TextBox ID="txt_remark" runat="server" >

<itemstyle horizontalalign="Center" verticalalign="Middle">

<footerstyle backcolor="‪#‎CCCC99‬" forecolor="Black">
<pagerstyle backcolor="White" forecolor="Black" horizontalalign="Right">
<SelectedRowStyle BackColor="‪#‎CC3333‬" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#333333" Font-Bold="True" Font-Names="Calibri"
ForeColor="White" />

==========================================================
table structure is :
==========================================================
student id : int
course :nvarchar(50)
sem:nvarchar(50)
subject:nvarchar(50)
period:nvarchar(50)
status:nvarchar(50) // it contains the present absent and leave details in text or int format what ever u wish
remark :nvarchar(50)
date:nvarchar(50)
==========================================================
i need c# code for this.
please give solution for this it too urgent
waiting for all your feedback
sender: Prasunjeet Soni
prasunjeet.soni04@rediffmail.com
Posted
Comments
Prasad Avunoori 8-May-14 5:01am    
You need to loop through the GridView.
Micky Solve 8-May-14 5:40am    
Please check the below link..

http://www.aspforums.net/Threads/400418/Insert-multiple-rows-from-GridView-to-Database-in-ASPNet/

Hi,

Please use TextChanged event of textbox, and in the code behind check whether the radio button is checked or not..


Like this...

protected void YourTextboxId_TextChanged(object sender, EventArgs e)
{
string value;

TextBox txtcityTitle = (TextBox)GridView1.FindControl("YourTextboxId");
RadioButton rdnButton = (RadioButton)GridView1.FindControl("YourRDBtnId");

value = txtcityTitle.Text;

if (rdnButton.Checked)
{
//Do Something
}

}
 
Share this answer
 
Please check this..

http://www.aspforums.net/Threads/400418/Insert-multiple-rows-from-GridView-to-Database-in-ASPNet/
 
Share this answer
 

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