473,397 Members | 1,985 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,397 software developers and data experts.

Datagrid edit question

Leo
I have a datagrid with the first column as a Edit,Update,Cancel 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
<EditItemTemplate> 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:Black;background-color:#EEEEEE;">
<td style="color:Blue;">
<a href="javascript:__doPostBack('grdStaff$_ctl4$_ctl 0','')"
style="color:Blue;">Edit</a>
</td>
<td>
<span>Beck, John</span>
</td>
<td>
<span id="grdStaff__ctl4_lblLoginName">BeckJ</span>
</td>
<td>
<span id="grdStaff__ctl4_lblPassword">1235</span>
</td>
<td>
<span id="grdStaff__ctl4_lblEmail">Jo*******@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 1608
Hi Leo,

Look at Page.RegisterClientScriptBlock 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
"FindControl" method to get to them.

Hope this helps.
Tony.

"Leo" wrote:
I have a datagrid with the first column as a Edit,Update,Cancel 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
<EditItemTemplate> 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:Black;background-color:#EEEEEE;">
<td style="color:Blue;">
<a href="javascript:__doPostBack('grdStaff$_ctl4$_ctl 0','')"
style="color:Blue;">Edit</a>
</td>
<td>
<span>Beck, John</span>
</td>
<td>
<span id="grdStaff__ctl4_lblLoginName">BeckJ</span>
</td>
<td>
<span id="grdStaff__ctl4_lblPassword">1235</span>
</td>
<td>
<span id="grdStaff__ctl4_lblEmail">Jo*******@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.itemdatabound event. I can even add the attributes
with Control.Attributes.Add("onmouseover", "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:TemplateColumn
HeaderText="Login">
<ItemTemplate>
<asp:Label
ID="lblLoginName"
runat="server"
Text='<%# DataBinder.Eval(Container.dataitem, "LoginName") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox
ID="txtLoginName"
runat="server"
width="95%"
Text='<%# DataBinder.Eval(Container.dataitem, "LoginName") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>

<asp:TemplateColumn
HeaderText="Password">
<ItemTemplate>
<asp:Label
ID="lblPassword"
runat="server"
Text='<%# DataBinder.Eval(Container.dataitem, "LoginPassword") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox
ID="txtPassword"
runat="server"
width="95%"
Text='<%# DataBinder.Eval(Container.dataitem, "LoginPassword") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>

"Tony John" <To******@discussions.microsoft.com> wrote in message
news:5D**********************************@microsof t.com...
Hi Leo,

Look at Page.RegisterClientScriptBlock 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
"FindControl" method to get to them.

Hope this helps.
Tony.

"Leo" wrote:
I have a datagrid with the first column as a Edit,Update,Cancel 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
<EditItemTemplate> 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:Black;background-color:#EEEEEE;">
<td style="color:Blue;">
<a href="javascript:__doPostBack('grdStaff$_ctl4$_ctl 0','')"
style="color:Blue;">Edit</a>
</td>
<td>
<span>Beck, John</span>
</td>
<td>
<span id="grdStaff__ctl4_lblLoginName">BeckJ</span>
</td>
<td>
<span id="grdStaff__ctl4_lblPassword">1235</span>
</td>
<td>
<span id="grdStaff__ctl4_lblEmail">Jo*******@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.itemdatabound event. I can even add the attributes
with Control.Attributes.Add("onmouseover", "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:TemplateColumn
HeaderText="Login">
<ItemTemplate>
<asp:Label
ID="lblLoginName"
runat="server"
Text='<%# DataBinder.Eval(Container.dataitem, "LoginName") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox
ID="txtLoginName"
runat="server"
width="95%"
Text='<%# DataBinder.Eval(Container.dataitem, "LoginName") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>

<asp:TemplateColumn
HeaderText="Password">
<ItemTemplate>
<asp:Label
ID="lblPassword"
runat="server"
Text='<%# DataBinder.Eval(Container.dataitem, "LoginPassword") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox
ID="txtPassword"
runat="server"
width="95%"
Text='<%# DataBinder.Eval(Container.dataitem, "LoginPassword") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>

"Tony John" <To******@discussions.microsoft.com> wrote in message
news:5D**********************************@microsof t.com...
Hi Leo,

Look at Page.RegisterClientScriptBlock 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
"FindControl" method to get to them.

Hope this helps.
Tony.

"Leo" wrote:
I have a datagrid with the first column as a Edit,Update,Cancel 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
<EditItemTemplate> 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:Black;background-color:#EEEEEE;">
<td style="color:Blue;">
<a href="javascript:__doPostBack('grdStaff$_ctl4$_ctl 0','')"
style="color:Blue;">Edit</a>
</td>
<td>
<span>Beck, John</span>
</td>
<td>
<span id="grdStaff__ctl4_lblLoginName">BeckJ</span>
</td>
<td>
<span id="grdStaff__ctl4_lblPassword">1235</span>
</td>
<td>
<span id="grdStaff__ctl4_lblEmail">Jo*******@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
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...
3
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...
1
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...
2
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,...
12
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...
2
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...
3
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...
1
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...
3
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...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
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...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.