如何在提交btn点击时将文本框和Gridview页脚文本框数据存储在数据库中。 [英] how to store textboxes and Gridview footer textboxes data in database when submit btn clicks.

查看:66
本文介绍了如何在提交btn点击时将文本框和Gridview页脚文本框数据存储在数据库中。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Experts!





使用C#,SqlServer 2005在Asp.net项目上工作。



目前正在使用Gridview,



首先,我在gridview页面上方有4个文本框,在Gridview页脚中有4个文本框,在girdview外面有一个提交按钮。



当我点击gridview外的提交按钮时。来自外部文本框的所有数据和来自页脚文本框的数据必须在数据库中提交。



请提前帮助谢谢。

解决方案

嗨Ranjith,



到现在为止,您必须能够在数据库中进行Db调用以添加/插入/更新/删除记录。

所以,我不打算告诉你怎么做。



对于,获取GridView Footer行的Textbox值,你可以这样搜索,



((TextBox)GridView.FooterRow.FindControl(  Textbox_Name))。文字; 





这应该会让你获得价值。您可以类似地获取其余部分,并进行Db调用以保存值。



快乐编码。!



谢谢,

Vamsi


 用于 每个 objGridItem 作为 Telerik.Web.UI.GridDataItem  grdQuestions.MasterTableView.Items()





 Dim chk  As  CheckBoxList = objGridItem.FindControl(  ChkListQuestion
如果 chk.SelectedValue = < span class =code-string> 然后
optioncode = chk.SelectedValue
结束 如果







  Dim  txtFreeText  As  TextBox = objGridItem.FindControl(  txtQuestion
suppliedtext = txtFreeText.Text







 Dim dropDown  As  RadComboBox = objGridItem.FindControl(  drpQuestion
如果 dropDown.SelectedValue = 然后
optioncode = dropDown.SelectedValue
结束 如果





下一页





dim dr as dropDown = GridView.FooterRow.FindControl(Dropdown1))。Text;


Hello Experts !


Am working on Asp.net Project using C#, SqlServer 2005.

presently am working on Gridview,

Firstly i have 4 textboxes above gridview and 4 textboxes in Gridview footer and a submit button outside girdview.

when i clicks the submit button outside gridview. all the data from outside textboxes and data from footer textboxes must be submitted in database.

Please help thanks in advance.

解决方案

Hi Ranjith,

By now, you must be able to make Db calls for add/insert/update/delete a records in the DB.
So, im not going to tell you how to do that.

For, getting the GridView Footer row''s Textbox value, you can search it this way,

((TextBox)GridView.FooterRow.FindControl("Textbox_Name")).Text;



This should get you the value. You can get the rest of them similarly and make a Db call to save the values.

Happy Coding.!

Thank you,
Vamsi


For Each objGridItem As Telerik.Web.UI.GridDataItem In grdQuestions.MasterTableView.Items()



Dim chk As CheckBoxList = objGridItem.FindControl("ChkListQuestion")
                   If Not chk.SelectedValue = "" Then
                       optioncode = chk.SelectedValue
                   End If




Dim txtFreeText As TextBox = objGridItem.FindControl("txtQuestion")
                   suppliedtext = txtFreeText.Text




Dim dropDown As RadComboBox = objGridItem.FindControl("drpQuestion")
                   If Not dropDown.SelectedValue = "" Then
                       optioncode = dropDown.SelectedValue
                   End If



Next


dim dr as dropDown= GridView.FooterRow.FindControl("Dropdown1")).Text;


这篇关于如何在提交btn点击时将文本框和Gridview页脚文本框数据存储在数据库中。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆