473,769 Members | 2,240 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid edit question

Leo
I have a datagrid with the first column as a Edit,Update,Can cel button
column. The other 5 columns are template columns. When I click the Edit
button in IE6 the row correctly displays the controls defined in the
<EditItemTempla te> however when I right click and do a view source I cannot
find any of the input textboxes in the source. I have used the
ItemDatabound event to try to attach javascript to the textboxes and in
debug mode while stepping through it seems to find the controls and add the
attributes but they never show up in the view source. Here is the source
line for just the datarow that is in the edit mode:

<tr style="color:Bl ack;background-color:#EEEEEE;" >
<td style="color:Bl ue;">
<a href="javascrip t:__doPostBack( 'grdStaff$_ctl4 $_ctl0','')"
style="color:Bl ue;">Edit</a>
</td>
<td>
<span>Beck, John</span>
</td>
<td>
<span id="grdStaff__c tl4_lblLoginNam e">BeckJ</span>
</td>
<td>
<span id="grdStaff__c tl4_lblPassword ">1235</span>
</td>
<td>
<span id="grdStaff__c tl4_lblEmail">J o*******@sc.org </span>
</td>
<td align="Center">
<font face="Wingdings "><b></b></font>
</td>
</tr>

It looks like it is still showing the Edit button even though the row is
displayed in the edit mode in IE. I have done a find in the source for
"BeckJ" and this one row is the only place it is found which is the line
being edited. How is IE displaying the textboxes and is it possible to
attach javascript to them?
Nov 19 '05 #1
3 1635
Hi Leo,

Look at Page.RegisterCl ientScriptBlock for information on how to attach
JavaScript to .NET server controls. If you want to get to the controls on the
server side, you will need to name the textboxes appropriately and use the
"FindContro l" method to get to them.

Hope this helps.
Tony.

"Leo" wrote:
I have a datagrid with the first column as a Edit,Update,Can cel button
column. The other 5 columns are template columns. When I click the Edit
button in IE6 the row correctly displays the controls defined in the
<EditItemTempla te> however when I right click and do a view source I cannot
find any of the input textboxes in the source. I have used the
ItemDatabound event to try to attach javascript to the textboxes and in
debug mode while stepping through it seems to find the controls and add the
attributes but they never show up in the view source. Here is the source
line for just the datarow that is in the edit mode:

<tr style="color:Bl ack;background-color:#EEEEEE;" >
<td style="color:Bl ue;">
<a href="javascrip t:__doPostBack( 'grdStaff$_ctl4 $_ctl0','')"
style="color:Bl ue;">Edit</a>
</td>
<td>
<span>Beck, John</span>
</td>
<td>
<span id="grdStaff__c tl4_lblLoginNam e">BeckJ</span>
</td>
<td>
<span id="grdStaff__c tl4_lblPassword ">1235</span>
</td>
<td>
<span id="grdStaff__c tl4_lblEmail">J o*******@sc.org </span>
</td>
<td align="Center">
<font face="Wingdings "><b></b></font>
</td>
</tr>

It looks like it is still showing the Edit button even though the row is
displayed in the edit mode in IE. I have done a find in the source for
"BeckJ" and this one row is the only place it is found which is the line
being edited. How is IE displaying the textboxes and is it possible to
attach javascript to them?

Nov 19 '05 #2
Leo
I have already built a scripting.cs class that does this. I have used it to
attach the javascript to controls on pages but I can't get it to work with
this datagrid. As you can see I have named all my controls and I can find
them in the datagrid.itemda tabound event. I can even add the attributes
with Control.Attribu tes.Add("onmous eover", "javascript "), they just never
show up in the IE view source and never do anything. I tried building a
simple project with just a one row datagrid with an edit column and when it
is in edit mode in IE the <input> controls show up fine, they just don't in
this datagrid.

Here is a snippet of the HTML view of the .aspx:
<asp:TemplateCo lumn
HeaderText="Log in">
<ItemTemplate >
<asp:Label
ID="lblLoginNam e"
runat="server"
Text='<%# DataBinder.Eval (Container.data item, "LoginName" ) %>'>
</asp:Label>
</ItemTemplate>
<EditItemTempla te>
<asp:TextBox
ID="txtLoginNam e"
runat="server"
width="95%"
Text='<%# DataBinder.Eval (Container.data item, "LoginName" ) %>'>
</asp:TextBox>
</EditItemTemplat e>
</asp:TemplateCol umn>

<asp:TemplateCo lumn
HeaderText="Pas sword">
<ItemTemplate >
<asp:Label
ID="lblPassword "
runat="server"
Text='<%# DataBinder.Eval (Container.data item, "LoginPassword" ) %>'>
</asp:Label>
</ItemTemplate>
<EditItemTempla te>
<asp:TextBox
ID="txtPassword "
runat="server"
width="95%"
Text='<%# DataBinder.Eval (Container.data item, "LoginPassword" ) %>'>
</asp:TextBox>
</EditItemTemplat e>
</asp:TemplateCol umn>

"Tony John" <To******@discu ssions.microsof t.com> wrote in message
news:5D******** *************** ***********@mic rosoft.com...
Hi Leo,

Look at Page.RegisterCl ientScriptBlock for information on how to attach
JavaScript to .NET server controls. If you want to get to the controls on
the
server side, you will need to name the textboxes appropriately and use the
"FindContro l" method to get to them.

Hope this helps.
Tony.

"Leo" wrote:
I have a datagrid with the first column as a Edit,Update,Can cel button
column. The other 5 columns are template columns. When I click the Edit
button in IE6 the row correctly displays the controls defined in the
<EditItemTempla te> however when I right click and do a view source I
cannot
find any of the input textboxes in the source. I have used the
ItemDatabound event to try to attach javascript to the textboxes and in
debug mode while stepping through it seems to find the controls and add
the
attributes but they never show up in the view source. Here is the source
line for just the datarow that is in the edit mode:

<tr style="color:Bl ack;background-color:#EEEEEE;" >
<td style="color:Bl ue;">
<a href="javascrip t:__doPostBack( 'grdStaff$_ctl4 $_ctl0','')"
style="color:Bl ue;">Edit</a>
</td>
<td>
<span>Beck, John</span>
</td>
<td>
<span id="grdStaff__c tl4_lblLoginNam e">BeckJ</span>
</td>
<td>
<span id="grdStaff__c tl4_lblPassword ">1235</span>
</td>
<td>
<span id="grdStaff__c tl4_lblEmail">J o*******@sc.org </span>
</td>
<td align="Center">
<font face="Wingdings "><b></b></font>
</td>
</tr>

It looks like it is still showing the Edit button even though the row is
displayed in the edit mode in IE. I have done a find in the source for
"BeckJ" and this one row is the only place it is found which is the line
being edited. How is IE displaying the textboxes and is it possible to
attach javascript to them?

Nov 19 '05 #3
I have attached the Javascript to the controls on the Page_Load event and it
works for me. Are you doing the same?

"Leo" wrote:
I have already built a scripting.cs class that does this. I have used it to
attach the javascript to controls on pages but I can't get it to work with
this datagrid. As you can see I have named all my controls and I can find
them in the datagrid.itemda tabound event. I can even add the attributes
with Control.Attribu tes.Add("onmous eover", "javascript "), they just never
show up in the IE view source and never do anything. I tried building a
simple project with just a one row datagrid with an edit column and when it
is in edit mode in IE the <input> controls show up fine, they just don't in
this datagrid.

Here is a snippet of the HTML view of the .aspx:
<asp:TemplateCo lumn
HeaderText="Log in">
<ItemTemplate >
<asp:Label
ID="lblLoginNam e"
runat="server"
Text='<%# DataBinder.Eval (Container.data item, "LoginName" ) %>'>
</asp:Label>
</ItemTemplate>
<EditItemTempla te>
<asp:TextBox
ID="txtLoginNam e"
runat="server"
width="95%"
Text='<%# DataBinder.Eval (Container.data item, "LoginName" ) %>'>
</asp:TextBox>
</EditItemTemplat e>
</asp:TemplateCol umn>

<asp:TemplateCo lumn
HeaderText="Pas sword">
<ItemTemplate >
<asp:Label
ID="lblPassword "
runat="server"
Text='<%# DataBinder.Eval (Container.data item, "LoginPassword" ) %>'>
</asp:Label>
</ItemTemplate>
<EditItemTempla te>
<asp:TextBox
ID="txtPassword "
runat="server"
width="95%"
Text='<%# DataBinder.Eval (Container.data item, "LoginPassword" ) %>'>
</asp:TextBox>
</EditItemTemplat e>
</asp:TemplateCol umn>

"Tony John" <To******@discu ssions.microsof t.com> wrote in message
news:5D******** *************** ***********@mic rosoft.com...
Hi Leo,

Look at Page.RegisterCl ientScriptBlock for information on how to attach
JavaScript to .NET server controls. If you want to get to the controls on
the
server side, you will need to name the textboxes appropriately and use the
"FindContro l" method to get to them.

Hope this helps.
Tony.

"Leo" wrote:
I have a datagrid with the first column as a Edit,Update,Can cel button
column. The other 5 columns are template columns. When I click the Edit
button in IE6 the row correctly displays the controls defined in the
<EditItemTempla te> however when I right click and do a view source I
cannot
find any of the input textboxes in the source. I have used the
ItemDatabound event to try to attach javascript to the textboxes and in
debug mode while stepping through it seems to find the controls and add
the
attributes but they never show up in the view source. Here is the source
line for just the datarow that is in the edit mode:

<tr style="color:Bl ack;background-color:#EEEEEE;" >
<td style="color:Bl ue;">
<a href="javascrip t:__doPostBack( 'grdStaff$_ctl4 $_ctl0','')"
style="color:Bl ue;">Edit</a>
</td>
<td>
<span>Beck, John</span>
</td>
<td>
<span id="grdStaff__c tl4_lblLoginNam e">BeckJ</span>
</td>
<td>
<span id="grdStaff__c tl4_lblPassword ">1235</span>
</td>
<td>
<span id="grdStaff__c tl4_lblEmail">J o*******@sc.org </span>
</td>
<td align="Center">
<font face="Wingdings "><b></b></font>
</td>
</tr>

It looks like it is still showing the Edit button even though the row is
displayed in the edit mode in IE. I have done a find in the source for
"BeckJ" and this one row is the only place it is found which is the line
being edited. How is IE displaying the textboxes and is it possible to
attach javascript to them?


Nov 19 '05 #4

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

Similar topics

3
2547
by: Diego TERCERO | last post by:
Hi... I'm working on a tool for editing text resources for a family of software product my company produces. These text resources are found in a SQL Server database, in a table called "Resource" with the following structure : Resource{,en,fr,es} Yes.. these are the only languages supported actually. A couple of rows in that table would look like this :
3
4885
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that the best method? Do you have a sample of how to do this?
1
279
by: Maziar Aflatoun | last post by:
Hi everyone, Here is my problem. I have a datagrid that I binds to a table with the following fields. PID FirstName LastName In my datagrid I display FirstName and LastName along with a edit option
2
2339
by: Sky | last post by:
Hello: Another question about trying to wring functionality from a DataGrid... Have a DB table of "Contacts" -- 14 or more fields per record Show in datagrid -- but only 5 columns (First,Last, Fax, Phone, Category). Put an Edit column at the end... Now what?! If you go into Edit mode -- you can only edit 5 cells -- not all the rest of the Record's fields...not enough!
12
2012
by: Daniel Walzenbach | last post by:
Hi, I want to display a Label in a DataGrid according to some condition. I therefore check whether the condition is true in the ItemDateBound EventHandler of the DataGrid. Unfortunately the conversion is extremely costly in performance. Does anybody know how I could set the label (of the whole content of the TableCell) to .Visible = False without converting e.Item.Controls(2) to a System.Web.UI.WebControls.Label?
2
5929
by: Fluxray | last post by:
--Background: I have a webform including a datagrid. The datagrid is using template. Its ItemTemplate is used to display a look-up-table with labels. its EditItemTemplate is used to edit a row in the look-up-table with textboxes. I have a linkbutton in each row (causevalidation = false) named 'Edit' to post the page back such that the page is switch from display mode to edit mode (labels -> textboxes for the row to be edited), and the...
3
1511
by: Schultz | last post by:
is there an easy to follow, source code in one document, article that explains how to create an edit all DataGrid control? and, I have a DataGrid setup where the client enters information for each row by clicking Edit-Update for each row. Each row has several columns, is there anyway to move the Edit function to edit each column individually for each row in the DataGrid?
1
1229
by: MrMike | last post by:
I have a sub named Bind("") which binds my a datagrid on my webform. In order to enter edit mode and edit records on this datagrid, I must make a call to Bind("") either before or after I place the DataGrid into edit mode. For example, DataGrid.EditCommand looks like this ... DataGrid1.EditItemIndex = e.Item.ItemIndex Bind("") Without having the Bind("") call within the EditCommand, an exception occurs saying something to the extent...
3
1643
by: CharlesA | last post by:
Hi folks, I really need help with the following scenario, I'm going to describe as well as a I can what the setup is and what I can't understand I'm using the framework 1.1 using ASP.net with C# I have a datagrid that is bound to a datasource (through ADO.net) and all that works
0
9590
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9424
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10223
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
9866
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
8879
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
6675
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
5310
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...
2
3571
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
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.