473,626 Members | 3,431 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(i dx)

'tbox

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

'todo: style: grdBF.ApplyForm atInEditMode = True

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

stCtrl = _

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

If colIsEditableAr ray(idx) = "true" Then grdBF.FooterTex t = stCtrl

dataGridView.Co lumns.Add(grdBF )

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

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

Dim tb As HtmlInputText =
dataGridView.Fo oterRow.FindCon trol(colNamesAr ray(idx) & "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.getEle mentById("txtSt ate");

var deForm = document.getEle mentById("form1 ");

state1.value = "insertclic ked" //indicate state

//debug:

var tb = document.getEle mentById("dataG ridView");

var i,j;

var msg;

for(i=0; i<tb.rows.lengt h;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 3013

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

Similar topics

2
2131
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 moment. Thank you very much!! Here is the gridview code:
1
1844
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 see the new inserted records in the gridview but I can't delete or edit them. When clicking on delete or edit link, nothing happens (no error either). All the others records (not inserted via the detailsview) can be edited and deleted.
2
3811
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. When they click on the button it fills in the textbox with some standard text. Question: In the code for the button how do I reference the textbox 'FreeTextBox1' (for the current edit row)? Here's the gridview layout...
4
2309
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 client has to choose one radiobutton per row (either YES, NO, or PERHAPS). Yes would have a value of 1, No 2, perhaps 3. 1) I need to restrict the choice to one of the three radiobuttons ? 2) Need to insert the client's choice for every row in...
0
2420
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 a data view (which in turn is loaded from a manually setup DataTable for testing purposes). One of the columns in the grid is a checkbox that's tied to an event handler that'll change the .Visible property of a column with a text box. That text...
0
1304
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 GridviewSummary, the specific data that I selected it will display the its details in GridviewDetails: I have a 2 gridview the gridviewsummary and gridviewdetails: gridviewsummary-contains Itemcode field(Primary key)
4
6025
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 am using AJAX and MasterPages as well as an update panel, the textbox is in a panel. I have tried to do it using different java scripts but I can't get it to work because I am not using asp forms, instead I am using Containers. Here is my code:...
1
4191
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 Source, but I cannot see it using an alert,
2
1785
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 SQLDataSource and a GridView control. I am using the GridView to test updating a very simple table in the database. The problem is, it will not Update the record at all! I placed this code outside of the admin folder and it worked fine. What could be causing...
0
8701
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8502
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7192
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5571
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1507
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.