Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > How to embed a text box in footertext of a GridView's boundfield

Reply
Thread Tools

How to embed a text box in footertext of a GridView's boundfield

 
 
Donzo
Guest
Posts: n/a
 
      10-16-2008
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


'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, AGI
http://doncollier.clickhere2.net
"Love converts hearts and gives peace."
 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      10-16-2008
Donzo wrote:
> 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.
>

There was no way for you to know it (except maybe by browsing through some
of the previous questions in this newsgroup before posting yours - always a
recommended practice) , but this is a classic (COM-based) asp newsgroup.
ASP.Net bears very little resemblance to classic ASP so, while you may be
lucky enough to find a dotnet-knowledgeable person here who can answer your
question, you can eliminate the luck factor by posting your question to a
group where those dotnet-knowledgeable people hang out. I suggest
microsoft.public.dotnet.framework.aspnet or the forums at www.asp.net.
--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
div box questions; float text around a box, fit box to image size Gnarlodious HTML 4 05-05-2010 11:30 AM
howto: embed a text box in a footer of a GridView's boundfield columnto get data prior to a row insert dcollier9@cox.net ASP .Net 0 10-16-2008 03:31 PM
ImageField and BoundField columns in a gridview control: =?Utf-8?B?QmVuamFtaW4=?= ASP .Net 0 04-20-2004 04:06 PM
Update the FooterText of DataGrid programatically Gheorghe Popescu ASP .Net Datagrid Control 0 08-27-2003 01:54 PM



Advertisments