网格视图中的访问控制并将其值存储到数据库中 [英] access control in grid view and store their values into database
问题描述
我有一个问题,请尽快找我,我需要紧急
我有一个网格视图,其中包含一些控件,如单选按钮和文本框。我希望将这些详细信息保存到相应的学生表中出席的内容
i想存储学生的出勤详情
html代码是
================================================= =========
< asp:GridView ID =GridView1runat =serverAutoGenerateColumns =False
BackColor =White BorderColor =#CCCCCCBorderStyle =NoneBorderWidth =1px
CellPadding =4ForeColor =BlackGridLines =Horizontal>
< columns>< asp:BoundField HeaderText =STUDENT IDDataField =stud_id>
< itemstyle horizontalalign =Centerverticalalign =Middle>
< asp:BoundField HeaderText =学生姓名DataField =stud_name>
< itemstyle horizontalalign =Left>
< asp:TemplateField HeaderText =ATTENDANCE>
< itemtemplate>
< asp :RadioButton ID =rb_presentrunat =serverText =Present GroupName =aChecked =true/>
< asp:RadioButton ID =rb_absentrunat =serverText =AbsentGroupName =a/>
< asp:RadioButton ID =rb_leaverunat =serverText =LeaveGroupName =a/>
< itemstyle width =200px>
< asp:TemplateField HeaderText =REMARK>
< itemtemplate>
< asp:TextBox ID =txt_remarkrunat =server>
< itemstyle horizontalalign =Center verticalalign =中间>
< footerstyle backcolor =#CCCC99forecolor =Black>
< pagerstyle backcolor =Whiteforecolor =Blackhorizontalalign =Right>
< SelectedRowStyle BackColor =#CC3333Font-Bold =TrueForeColor = 白色/>
< HeaderStyle BackColor =#333333Font-Bold =True字体名称=Calibri
ForeColor =白色 />
=============================== ============= ==============
表结构是:
================ ==========================================
学生编号:int
课程:nvarchar(50)
sem:nvarchar(50)
科目:nvarchar(50)
期限:nvarchar(50)
状态:nvarchar(50)//它包含当前缺席并以文本或整数格式留下您希望的内容
备注:nvarchar(50)
日期:nvarchar(50)
===================== =====================================
i需要c#代码。
请为此解决这个问题太紧急
等待您的所有反馈
发件人:Prasunjeet Soni
prasunjeet.soni04@rediffmail.com
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
推荐答案
请使用Textbox的TextChanged事件,在后面的代码中检查单选按钮是否被检查..
喜欢这个...
prot已取消YourTextboxId_TextChanged(对象发件人,EventArgs e)
{
字符串值;
TextBox txtcityTitle =( TextBox)GridView1.FindControl(YourTextboxId);
RadioButton rdnButton =(RadioButton)GridView1.FindControl(YourRDBtnId);
value = txtcityTitle.Text;
if(rdnButton.Checked)
{
//做点什么< br $>
}
}
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
}
}
请检查这个..
http://www.aspforums.net/Threads/400418/Insert-multiple-rows-from-GridView-to-Database-in-ASPNet/
Please check this..
http://www.aspforums.net/Threads/400418/Insert-multiple-rows-from-GridView-to-Database-in-ASPNet/
这篇关于网格视图中的访问控制并将其值存储到数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!