473,396 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

howto: embed a text box in a footer of a GridView's boundfield columnto get data prior to a row insert

Hi !

I need to embed a text box in a footer of a GridView's boundfield
column to get data prior to a row insert.

The textbox is usable and showing up in the web page source using View
Source, but I cannot see it using an alert,

or after postback on the server side (code behind). Is there a way to
reference such a control (embedded HTML in footertext) ?

If so, please advise ! (I embedded buttons in the command column which
work and execute their click events ok)

this code builds the footertext:

Dim grdBF As BoundField = New BoundField

grdBF.DataField = colNamesArray(idx)

'tbox

If colIsEditableArray(idx) = "false" Then grdBF.ReadOnly = True

'todo: style: grdBF.ApplyFormatInEditMode = True

'this always puts a textbox in if editable, todo: chg to add some
input control per type:

stCtrl = _

"<input id=""" & colNamesArray(idx) & "textbox"" Type=""Text""
size=""20"" maxlength=""30"" value="""">test</input>"

If colIsEditableArray(idx) = "true" Then grdBF.FooterText = stCtrl

dataGridView.Columns.Add(grdBF)

''''''''''''''''''''''''''''''''''''''

this code tries to access after postback, server side, but does not
work, fix needed:

Dim tb As HtmlInputText =
dataGridView.FooterRow.FindControl(colNamesArray(i dx) & "textbox")

''''''''''''''''''''''''''''''''''''

This code tries to show it client-side, at click event, before the
postback-submit:
(we can show only the innertext)

var state1 = document.getElementById("txtState");

var deForm = document.getElementById("form1");

state1.value = "insertclicked" //indicate state

//debug:

var tb = document.getElementById("dataGridView");

var i,j;

var msg;

for(i=0; i<tb.rows.length;i++)

{

msg += "\r\n" + tb.rows[i].cells[2].innerText;

}

alert(msg);

deForm.submit() //postback to server to save the data only

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
the fix must be server side in code behind, since this all must be
completely dynamic, and is dependent on a config file to get its table
data from a sqldatasource which requires the boundfields in this
gridview. fyi my templatefield columns all work fine, getting the data
back in the request object since its otherwise blown away by a
postback.

Regards !

Don

-------------------------------------------

Don Collier, Senior Developer

Web Site: http://doncollier.clickhere2.net

Oct 16 '08 #1
0 2999

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: guanfenglin | last post by:
Hello, I have a grid view which display and updates the data, however it doesn't work well, I always either get invalid name/number or not all varaibles bound, I am very frustrated at the...
1
by: Marc | last post by:
Hi, I made a detailsview for inserting records. I also made a gridview for editing and deleting the same records. The keyfield is an autonumbering field in Access (pcnr). My problem is: I can...
2
by: VB Programmer | last post by:
I have a gridview control with several data fields. When the user clicks 'edit' for the row I want the user to be able to edit a particular text field. Under that 'edit' textbox is a button. ...
4
by: Patrik | last post by:
hello, based on a client login I call a GridView that presents the appropriate questionnaire for that person. I added three columns (template fields) to the gridview that are radiobuttons. The...
0
by: landesjoe | last post by:
Hi, here's my problem in short: Text boxes in gridview don't seem to hold their value if the column's .Visible property is changed back and forth. I've got a form with a gridview populated from...
0
by: jaredciagar | last post by:
Hi Guys, Can You Help Me PLease, I'm Currently facing Problems in my system... I need some help... I'm using VB script,ASP.net,MS SQL Server2005 I want to select a specific data in...
4
by: pablorp80 | last post by:
Hello, Here is what I need: I need the focus and the cursor set to a textbox named txtGT, every time no matter if it is the first page load or whether it is a postback. Here is the problem: I...
1
by: =?Utf-8?B?RG9uem8=?= | last post by:
Hi ! I need to embed a text box in a footer of a GridView's boundfield column to get data prior to a row insert. The textbox is usable and showing up in the web page source using View...
2
by: xMetalDetectorx | last post by:
Hi Everyone, I have a very simple web app that uses .Net 2.0 login control to authenticate users and allow access to an "admin" folder. Inside that admin folder I have one page that has a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.