innertext,javascript,datagrid,数据库更新 [英] innertext, javascript, datagrid, database update

查看:73
本文介绍了innertext,javascript,datagrid,数据库更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ASP.NET中编写了一个包含一些javascript的网页,以便当用户按下按钮时,或者在数据网格中编辑某个字段时,

,另一个
$ b数据网格中的$ b单元格中填充了一个值。


我的问题....当我让用户按下更新按钮时(这是一个

回发通过数据网格循环并更新数据库)由javascript填充的

字段/单元格在我的更新中显示为空白

代码,即使我可以在屏幕上看到它。


我的java脚本代码填充了所需的单元格(这个工作);


函数AddRequesterName(imgObj )

{

imgObj.parentNode.parentNode.childNodes(8).innerTe xt = UserName.outerText;

}


我在VB.NET中更新数据库的代码;

Dim strEntryID As String = dgi.Cells(11).Text


这适用于网格中的所有其他字段,除此之外è?原因

为什么它是单元格(11)是因为显示屏中有3个隐藏单元格。


我有一个感觉它与它有关innertext和引用

cell.text,但是cells属性没有innertext。


对此有什么帮助吗?


Lyners

I have a web page writen in ASP.NET that contains some javascript so that
when a user presses a button, or edits a certain field in a datagrid, another
cell in the datagrid is filled with a value.

My probelm.... when I have the user press the update button (which does a
post back that loops through the datagrid and updates a database) the
field/cell that is filled by the javascript appears to be blank in my update
code, even though I can see it on the screen.

My java script code that populates the desired cell (this works);

function AddRequesterName(imgObj)
{
imgObj.parentNode.parentNode.childNodes(8).innerTe xt=UserName.outerText;
}

My code in the VB.NET that updates the database;

Dim strEntryID As String = dgi.Cells(11).Text

This works for all the other fields in the grid, except this one? The reason
why it is cell(11) is because there are 3 hidden cells in the display.

I have a felling it has something to do with innertext and referencing
cell.text, but the cells attribute doesn''t have an innertext.

Any help on this?

Lyners

推荐答案

在VS.net中,使用调试器逐步执行代码并检查值

dgi.Cells(11).Controls.count。这个单元格中还有其他控件吗?您正在寻找的

值可能在其中一个控件中,而不是在单元格本身的Text属性中




HTH

-

Phillip Williams
http://www.societopia.net
http:// www.webswapp.com

" Lyners"写道:
In VS.net, use the debugger to step through the code and examine the value of
dgi.Cells(11).Controls.count. Are there other controls in this cell? The
value you are looking for might be in one of those controls rather than in
the Text property of the cell itself.

HTH
--
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Lyners" wrote:
我在ASP.NET中写了一个包含一些javascript的网页,以便当用户按下按钮或编辑数据网格中的某个字段时,数据网格中的另一个
单元格中填充了一个值。

我的问题......当我让用户按下更新按钮时(它会回复该循环)通过数据网格并更新数据库)由javascript填充的
字段/单元格在我的更新代码中显示为空白,即使我可以在屏幕上看到它。

我的java脚本代码填充了所需的单元格(这可以工作);

函数AddRequesterName(imgObj)

imgObj.parentNode.parentNode.childNodes(8)。 innerTe xt = UserName.outerText;
}

我在VB.NET中更新数据库的代码;

Dim strEntryID As String = dgi.Cells(11 ).Text

这适用于网格中的所有其他字段,除了这个字段?
为什么它是cell(11)的原因是因为显示器中有3个隐藏的单元格。

我有一个感谢它与innertext有关并且引用了
cell .text,但是单元格属性没有innertext。

有任何帮助吗?

Lyners
I have a web page writen in ASP.NET that contains some javascript so that
when a user presses a button, or edits a certain field in a datagrid, another
cell in the datagrid is filled with a value.

My probelm.... when I have the user press the update button (which does a
post back that loops through the datagrid and updates a database) the
field/cell that is filled by the javascript appears to be blank in my update
code, even though I can see it on the screen.

My java script code that populates the desired cell (this works);

function AddRequesterName(imgObj)
{
imgObj.parentNode.parentNode.childNodes(8).innerTe xt=UserName.outerText;
}

My code in the VB.NET that updates the database;

Dim strEntryID As String = dgi.Cells(11).Text

This works for all the other fields in the grid, except this one? The reason
why it is cell(11) is because there are 3 hidden cells in the display.

I have a felling it has something to do with innertext and referencing
cell.text, but the cells attribute doesn''t have an innertext.

Any help on this?

Lyners



嗨Phillip,

我做了dgi.Cells(11).Controls.count并得到了0的结果。我试过了

属性也只有获得零值。我在datagrid单元格中没有任何控件

。我只是用他们修改的每一行的用户ID

加载单元格。


我想要发生的是当他们更新时页面通过回发

将单元格值传递回服务器,以便代码可以更新数据库中的

用户ID字段。似乎单元格没有传回

任何值。


有关更好的编码方式或如何使其工作的任何建议吗?

" Phillip Williams"写道:
Hi Phillip,
I did the dgi.Cells(11).Controls.count and got a result of 0. I tried
attributes too only to get a zero value for that. I don''t have any controls
in the datagrid cell. I am just loading the cells innertext with the users id
for everyline that they modify.

What I want to have happen is when they "update" the page via a postback
that the cell value is passed back to the server so the code can update the
userid field in the database. it appears that the cell is not passing back
any values.

Any suggestions on a better way to code this, or how to make this work?
"Phillip Williams" wrote:
在VS.net中,使用调试器逐步执行代码并检查
dgi.Cells(11).Controls.count的值。这个单元格中还有其他控件吗?您正在寻找的
值可能在其中一个控件中,而不是在单元格本身的Text属性中。

HTH
-
Phillip Williams
http://www.societopia.net
http://www.webswapp.com

" Lyners" ;写道:
In VS.net, use the debugger to step through the code and examine the value of
dgi.Cells(11).Controls.count. Are there other controls in this cell? The
value you are looking for might be in one of those controls rather than in
the Text property of the cell itself.

HTH
--
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Lyners" wrote:
我在ASP.NET中写了一个包含一些javascript的网页,以便当用户按下按钮或编辑数据网格中的某个字段时,数据网格中的另一个
单元格中填充了一个值。

我的问题......当我让用户按下更新按钮时(它会回复该循环)通过数据网格并更新数据库)由javascript填充的
字段/单元格在我的更新代码中显示为空白,即使我可以在屏幕上看到它。

我的java脚本代码填充了所需的单元格(这可以工作);

函数AddRequesterName(imgObj)

imgObj.parentNode.parentNode.childNodes(8)。 innerTe xt = UserName.outerText;
}

我在VB.NET中更新数据库的代码;

Dim strEntryID As String = dgi.Cells(11 ).Text

这适用于网格中的所有其他字段,除了这个字段?
为什么它是cell(11)的原因是因为显示器中有3个隐藏的单元格。

我有一个感谢它与innertext有关并且引用了
cell .text,但是属性没有innertext。

有任何帮助吗?

Lyners
I have a web page writen in ASP.NET that contains some javascript so that
when a user presses a button, or edits a certain field in a datagrid, another
cell in the datagrid is filled with a value.

My probelm.... when I have the user press the update button (which does a
post back that loops through the datagrid and updates a database) the
field/cell that is filled by the javascript appears to be blank in my update
code, even though I can see it on the screen.

My java script code that populates the desired cell (this works);

function AddRequesterName(imgObj)
{
imgObj.parentNode.parentNode.childNodes(8).innerTe xt=UserName.outerText;
}

My code in the VB.NET that updates the database;

Dim strEntryID As String = dgi.Cells(11).Text

This works for all the other fields in the grid, except this one? The reason
why it is cell(11) is because there are 3 hidden cells in the display.

I have a felling it has something to do with innertext and referencing
cell.text, but the cells attribute doesn''t have an innertext.

Any help on this?

Lyners



Hello Lyners,


在这个非常简单的演示中,我复制了值,我仍然可以检索它

在回发时: http://www.societopia.net/samples/datagrid_2.aspx


也许你的代码中有一个重置这个值的步骤。


顺便说一句,你有没有发现为什么在最后一个示例中将

鼠标移动到复制图像上时(在此

问题的上一个帖子中),图像标题无法正常工作?

-

Phillip Williams
http://www.societopia.net
http://www.webswapp.com

" Lyners"写道:
Hello Lyners,

In this very simple demo, I copy the value and am still able to retrieve it
upon postback: http://www.societopia.net/samples/datagrid_2.aspx

Maybe there is a step in your code that is resetting this value.

BTW, did you find out why the image title was not working when you moved the
mouse over the copy image in the last example (in a previous thread on this
issue)?
--
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Lyners" wrote:
嗨菲利普,
我做了dgi.Cells(11).Controls.count并得到了0的结果。我只尝试了
属性获得零值。我在datagrid单元格中没有任何控件。我只是用他们修改的每一行的用户ID加载单元格。

我想要发生的是他们更新的时间。页面通过回发
将单元格值传递回服务器,以便代码可以更新数据库中的用户ID字段。好像单元格没有传回任何值。

有关更好的编码方法或如何使其工作的任何建议吗?

" ;菲利普威廉姆斯写道:
Hi Phillip,
I did the dgi.Cells(11).Controls.count and got a result of 0. I tried
attributes too only to get a zero value for that. I don''t have any controls
in the datagrid cell. I am just loading the cells innertext with the users id
for everyline that they modify.

What I want to have happen is when they "update" the page via a postback
that the cell value is passed back to the server so the code can update the
userid field in the database. it appears that the cell is not passing back
any values.

Any suggestions on a better way to code this, or how to make this work?
"Phillip Williams" wrote:
在VS.net中,使用调试器逐步执行代码并检查
dgi.Cells(11).Controls.count的值。这个单元格中还有其他控件吗?您正在寻找的
值可能在其中一个控件中,而不是在单元格本身的Text属性中。

HTH
-
Phillip Williams
http://www.societopia.net
http://www.webswapp.com

" Lyners" ;写道:
In VS.net, use the debugger to step through the code and examine the value of
dgi.Cells(11).Controls.count. Are there other controls in this cell? The
value you are looking for might be in one of those controls rather than in
the Text property of the cell itself.

HTH
--
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Lyners" wrote:
我在ASP.NET中写了一个包含一些javascript的网页,以便当用户按下按钮或编辑数据网格中的某个字段时,数据网格中的另一个
单元格中填充了一个值。

我的问题......当我让用户按下更新按钮时(它会回复该循环)通过数据网格并更新数据库)由javascript填充的
字段/单元格在我的更新代码中显示为空白,即使我可以在屏幕上看到它。

我的java脚本代码填充了所需的单元格(这可以工作);

函数AddRequesterName(imgObj)

imgObj.parentNode.parentNode.childNodes(8)。 innerTe xt = UserName.outerText;
}

我在VB.NET中更新数据库的代码;

Dim strEntryID As String = dgi.Cells(11 ).Text

这适用于网格中的所有其他字段,除了这个字段?
为什么它是cell(11)的原因是因为显示器中有3个隐藏的单元格。

我有一个感谢它与innertext有关并且引用了
cell .text,但是单元格属性没有innertext。

有任何帮助吗?

Lyners
I have a web page writen in ASP.NET that contains some javascript so that
when a user presses a button, or edits a certain field in a datagrid, another
cell in the datagrid is filled with a value.

My probelm.... when I have the user press the update button (which does a
post back that loops through the datagrid and updates a database) the
field/cell that is filled by the javascript appears to be blank in my update
code, even though I can see it on the screen.

My java script code that populates the desired cell (this works);

function AddRequesterName(imgObj)
{
imgObj.parentNode.parentNode.childNodes(8).innerTe xt=UserName.outerText;
}

My code in the VB.NET that updates the database;

Dim strEntryID As String = dgi.Cells(11).Text

This works for all the other fields in the grid, except this one? The reason
why it is cell(11) is because there are 3 hidden cells in the display.

I have a felling it has something to do with innertext and referencing
cell.text, but the cells attribute doesn''t have an innertext.

Any help on this?

Lyners



这篇关于innertext,javascript,datagrid,数据库更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆