那么,我认为没有人能解决这个问题吗? [英] So, should I think no one has a solution to this?

查看:58
本文介绍了那么,我认为没有人能解决这个问题吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过去两周我一直在发布这个问题,

没有任何回复。我真的不明白为什么我没有得到任何答复。我的问题听起来很

愚蠢吗?无论如何,我在这里再问一次。有人请

请帮帮我!!

如何在数据列表中添加radiobuttonlist

以编程方式。


我的实际问题是同时检索用户输入和

表格值。

我有一个数据控件aspx页面(这是

分页并且每次提交给自己)。我在我的datalist中调用一个以字符串形式返回html

控件(单选按钮)的函数。
我还在数据库中使用了
的asp服务器控件(标签)。当

处理表单时,我正在通过Request.form检索

单选按钮的值。要检索asp服务器控件的值

,我使用FindControl

方法。但这是用Page_Load方法编写的,所以

它会在页面

被提交之前返回当前页面的值。我想要在页面获得

提交后的值。我如何检索它们。

如果我在我的按钮上使用onserverclick(这是一个带翻转功能的html

控件< a href>),

onclick对于验证html

控件无效。我没有在我的表格标签上使用runat = server,因为我在
按钮上有onclick属性。我是新来的

asp.net。我无法同时使用onclick和

onserverclick。为什么会这样..


请帮助!!


< form id =" frmQuestion"方法= QUOT;交" >


< ASP:DataList id =" Questions" ShowHeader =" false"

ShowFooter =" false" RUNAT = QUOT;服务器" >

< ItemTemplate>

< TABLE ALIGN =" left" >

< td>


< asp:Label runat =" server" Text =''<%#DataBinder.Eval

(Container.DataItem," MainQuestion_ID")%> ''

ID =" QuestionID" NAME =" QuestionID"

< / asp:Label>


< / td>


< td>


< asp:Label runat =" server" Text =''<%#DataBinder.Eval

(Container.DataItem," MainQuestion_Txt")%>''

ID =" QuestionTxt" NAME =" QuestionTxt">

< / asp:Label>


< / td>


< td>


<%#DisplayAnswers(DataBinder.Eval

(Container.DataItem," MainQuestion_ID")),DataBinder.Eval

(Container.DataItem," QuestionTypeID"))%>


< / td>

< / tr>< / TABLE>

< / ItemTemplate>

< / ASP:DataList>


< table align = right>

< tr>< td>


< a id = btnForward href ="#"

onMouseOut =" bforward.src =''images / bforward.gif'';"

onMouseOver =" bforward.src =''images / bforward_f2.gif'';

runat = server onclick =" return validate();">< IMG

SRC =" images / bforward.gif" ALT ="" NAME =" bforward"

ID =" bforward" WIDTH =" 78" HEIGHT =" 24英寸; BORDER =" 0">< / A>


< / td>< / tr>< / table>

我会喜欢在点击按钮的同时检索问题ID和答案

(用户输入)。



问卷是分页,这是我使用的唯一形式。


背后的代码看起来有点像:


Sub Page_Load(ByVal Sender As Object,ByVal E As

EventArgs)

Dim oDt As DataTable

Dim oQuestion As Question('''这是我的业务层中的





oQuestion =新问题


问题.DataSource = New DataView(oDt)

Questions.DataBind()


End Sub

如何获得questionid'' s和用户输入

插入数据库。可以有子请求

解决方案

Ani,


您需要设置控件使用runat = server。然后在你的页面加载

使用:

如果不是IsPostBack,那么控件只会在第一次设置。


现在,在回传表单时,控件值不会被覆盖,而

则通过FindControl获取它们。


我希望这会有所帮助。 />

(过去两周我没有看过论坛,我已经在一个大型项目上工作了,或者我会已经回答了你。)

此致,


-

S. Justin Gengo,MCP

Web开发人员


免费代码库:
www.aboutfortunate.com


混乱无序。

Nietzche

" ANI" <一个******* @ discussions.microsoft.com>在消息中写道

新闻:0f **************************** @ phx.gbl ... < blockquote class =post_quotes>过去两周我一直在发布这个问题,而且没有任何回复。我真的不明白为什么我没有收到任何回复。我的问题听起来很尴尬吗?无论如何,我在这里再问一次。有人请
请帮助我!!

如何在数据表中添加radiobuttonlist以编程方式

我的实际问题是检索用户-input和
表单值同时。
我的aspx页面中有一个datalist控件(这是分页的,每次都提交给自己)。我在我的datalist中调用一个函数,它以字符串的形式返回一个html
控件(单选按钮)。我还在datalist中拥有asp服务器控件(标签)。当表单处理完毕后,我正在通过Request.form检索
单选按钮的值。要检索asp服务器控件的值,我正在使用FindControl
方法。但是这是用Page_Load方法编写的,所以它会在页面提交之前返回当前页面的值。我希望在页面提交后提供值。我如何检索它们。
如果我使用onserverclick我的按钮(这是一个具有翻转功能的html
控件< a href>),
onclick不能正常工作验证html
控件。当我在按钮上有onclick属性时,我的表单标签上没有runat = server。我是
asp.net的新手。我无法同时使用onclick和
onserverclick。为什么会这样..

请帮助!!

< form id =" frmQuestion"方法= QUOT;交" >

< ASP:DataList id ="问题" ShowHeader =" false"
ShowFooter =" false" RUNAT = QUOT;服务器" >
< ItemTemplate>
< TABLE ALIGN =" left" >
< td>

< asp:Label runat =" server" Text =''<%#DataBinder.Eval
(Container.DataItem," MainQuestion_ID")%> ''
ID =" QuestionID" NAME =" QuestionID">
< / asp:标签>

< / td>

< td>

< asp:Label runat =" server" Text =''<%#DataBinder.Eval
(Container.DataItem," MainQuestion_Txt")%>''
ID =" QuestionTxt" NAME =" QuestionTxt">
< / asp:标签>

< / td>

< td>

<%#DisplayAnswers(DataBinder.Eval
(Container.DataItem," MainQuestion_ID"),DataBinder.Eval
(Container.DataItem," QuestionTypeID"))%>

< / td>
< / tr>< / TABLE>
< / ItemTemplate>
< / ASP:DataList>

< table align = right>
< tr>< td>

< a id = btnForward href ="#"
onMouseOut = " bforward.src =''images / bforward.gif'';"
onMouseOver =" bforward.src =''images / bforward_f2.gif'';"
runat = server onclick =" return validate();">< IMG
SRC =" images / bforward.gif" ALT ="" NAME =" bforward"
ID =" bforward" WIDTH =" 78" HEIGHT =" 24英寸; BORDER =" 0">< / A>

< / td>< / tr>< / table>

我想要检索问题ID和答案
(用户输入)同时点击按钮。

问卷是分页的,这是我使用的唯一形式。

后面的代码看起来有点像这样:

Sub Page_Load(ByVal Sender As Object,ByVal E As
EventArgs)

Dim oDt as DataTable
Dim oQuestion As Question(''这是我的业务层中的

oQuestion =新问题

Questions.DataSource =新DataView(oDt)
Questions.DataBind()

结束子

我如何获得问题和用户输入
插入数据库。可以有子请求



要在列表中添加按钮,请将这样的代码添加到itemdatabound

e.item.cells [0] .Controls.Add(new radiobuttonlist())


实际上你应该在外面创建你的radiobutton,给它一个ID,设置它的

值,然后添加它。

当你想检查帖子中的选择时,只需对

id进行查找控制并检查选择属性。


这有帮助吗?


PS。我没看到这篇文章,我会早点回复。如果你更容易

给你的问题一个好主题,这样他们就有更好的机会抓住

某人的注意力


-

-----------

有TidBits吗?

来这里: www.networkip.net/tidbits

" ani" <一个******* @ discussions.microsoft.com>在消息中写道

新闻:0f **************************** @ phx.gbl ... < blockquote class =post_quotes>过去两周我一直在发布这个问题,而且没有任何回复。我真的不明白为什么我没有收到任何回复。我的问题听起来很尴尬吗?无论如何,我在这里再问一次。有人请
请帮助我!!

如何在数据表中添加radiobuttonlist以编程方式

我的实际问题是检索用户-input和
表单值同时。
我的aspx页面中有一个datalist控件(这是分页的,每次都提交给自己)。我在我的datalist中调用一个函数,它以字符串的形式返回一个html
控件(单选按钮)。我还在datalist中拥有asp服务器控件(标签)。当表单处理完毕后,我正在通过Request.form检索
单选按钮的值。要检索asp服务器控件的值,我正在使用FindControl
方法。但是这是用Page_Load方法编写的,所以它会在页面提交之前返回当前页面的值。我希望在页面提交后提供值。我如何检索它们。
如果我使用onserverclick我的按钮(这是一个具有翻转功能的html
控件< a href>),
onclick不能正常工作验证html
控件。当我在按钮上有onclick属性时,我的表单标签上没有runat = server。我是
asp.net的新手。我无法同时使用onclick和
onserverclick。为什么会这样..

请帮助!!

< form id =" frmQuestion"方法= QUOT;交" >

< ASP:DataList id ="问题" ShowHeader =" false"
ShowFooter =" false" RUNAT = QUOT;服务器" >
< ItemTemplate>
< TABLE ALIGN =" left" >
< td>

< asp:Label runat =" server" Text =''<%#DataBinder.Eval
(Container.DataItem," MainQuestion_ID")%> ''
ID =" QuestionID" NAME =" QuestionID">
< / asp:标签>

< / td>

< td>

< asp:Label runat =" server" Text =''<%#DataBinder.Eval
(Container.DataItem," MainQuestion_Txt")%>''
ID =" QuestionTxt" NAME =" QuestionTxt">
< / asp:标签>

< / td>

< td>

<%#DisplayAnswers(DataBinder.Eval
(Container.DataItem," MainQuestion_ID"),DataBinder.Eval
(Container.DataItem," QuestionTypeID"))%>

< / td>
< / tr>< / TABLE>
< / ItemTemplate>
< / ASP:DataList>

< table align = right>
< tr>< td>

< a id = btnForward href ="#"
onMouseOut = " bforward.src =''images / bforward.gif'';"
onMouseOver =" bforward.src =''images / bforward_f2.gif'';"
runat = server onclick =" return validate();">< IMG
SRC =" images / bforward.gif" ALT ="" NAME =" bforward"
ID =" bforward" WIDTH =" 78" HEIGHT =" 24英寸; BORDER =" 0">< / A>

< / td>< / tr>< / table>

我想要检索问题ID和答案
(用户输入)同时点击按钮。

问卷是分页的,这是我使用的唯一形式。

后面的代码看起来有点像这样:

Sub Page_Load(ByVal Sender As Object,ByVal E As
EventArgs)

Dim oDt as DataTable
Dim oQuestion As Question(''这是我的业务层中的

oQuestion =新问题

Questions.DataSource =新DataView(oDt)
Questions.DataBind()

结束子

我如何获得问题和用户输入
插入数据库。可以有子问题



Ani,


听起来好像你不是完全理解经典

asp和.net之间的区别。


你是对的。如果你只是将一个函数输出原始html到

页面,那么你就不能使用runat = server标签。


runat = server标签去了在.aspx文件中的控件'标签内部和

意味着它附加的控件将在服务器交付给客户端之前由服务器评估




你应该看一下这里教程中提供的示例代码:

http://samples.gotdotnet.com/quickstart/aspplus/


这些教程将会给你所需的知识,了解.net

的工作原理。


祝你好运!


- -

S. Justin Gengo,MCP

Web开发人员


免费代码库:
www.aboutfortunate.com


" out of chaos com es订单。

Nietzche

" ani" <一个******* @ discussions.microsoft.com>在留言中写道

news:0c **************************** @ phx.gbl ... < blockquote class =post_quotes>感谢您的回复。我会试着说。如果我使用runat
属性,则javascript无法正常工作。这就是问题所在。如何使javascript和
onserverclick事件工作。 javascript验证了
html控件。顺便说一句,我可以同时拥有asp服务器
控件和html控件,我在下面的编码方式。
html控件以函数的字符串
的形式返回。我想即使我在我的
控件上使用runat = server,它也没什么区别,因为html
控件是返回页面的文本字符串。并且,我不能在表单标签上使用runat = server,因为如果我使用它,我的
javascript就无法正常运行。
请你推荐别的东西..

再次感谢您的帖子。

PS如果我说''没有人帮助我',而不是主题是'',那么人们会非常好奇不能同时使用
onserverclick和onclick'':-)

-----原帖-----
Ani,
你需要设置你的控件以使用runat = server。


然后在你的页面中加载

使用:
如果不是IsPostBack那么控件只会在第一次设置



现在回传表单控件值不会

<当

你通过FindControl得到它们时会被覆盖。

我希望这会有所帮助。

(我没有带过它好的,在过去的两个论坛


周,我已经

正在开展一个大项目,或者我会回答你。)

此致,

-
S. Justin Gengo,MCP
Web开发人员

免费代码库位于:
www.aboutfortunate.com

出于混乱而来的订单。Nietzche

" ani" <一个******* @ discussions.microsoft.com>写在


消息

新闻:0f **************************** @phx.gbl ...

过去两周我一直在发布这个问题,但没有任何回复。我真的不明白为什么我没有得到任何回应。我的问题听起来很愚蠢吗?无论如何,我在这里再问一次。有人请
请帮助我!!

如何在数据表中添加radiobuttonlist以编程方式

我的实际问题是检索用户-input和
表单值同时。
我的aspx页面中有一个datalist控件(这是分页的,每次都提交给自己)。我在我的datalist中调用一个函数,它以字符串的形式返回一个html控件(单选按钮)。我在datalist中也有asp服务器控件(标签)。当表单处理完毕后,我正在通过Request.form检索
单选按钮的值。要检索asp服务器控件的值,我使用的是FindControl
方法。但是这是用Page_Load方法编写的,所以它在页面提交之前返回当前页面的值。我希望在页面提交后提供值。我如何检索它们。
如果我使用onserverclick我的按钮(这是一个具有翻转功能的html
控件< a href>),
onclick不能正常工作验证html
控件。当我在按钮上有onclick属性时,我的表单标签上没有runat = server。我是
asp.net的新手。我无法同时使用onclick和
onserverclick。为什么会这样..

请帮助!!

< form id =" frmQuestion"方法= QUOT;交" >

< ASP:DataList id ="问题" ShowHeader =" false"
ShowFooter =" false" RUNAT = QUOT;服务器" >
< ItemTemplate>
< TABLE ALIGN =" left" >
< td>

< asp:Label runat =" server" Text =''<%#DataBinder.Eval
(Container.DataItem," MainQuestion_ID")%> ''
ID =" QuestionID" NAME =" QuestionID">
< / asp:标签>

< / td>

< td>

< asp:Label runat =" server" Text =''<%#DataBinder.Eval
(Container.DataItem," MainQuestion_Txt")%>''
ID =" QuestionTxt" NAME =" QuestionTxt">
< / asp:标签>

< / td>

< td>

<%#DisplayAnswers(DataBinder.Eval
(Container.DataItem," MainQuestion_ID"),DataBinder.Eval
(Container.DataItem," QuestionTypeID"))%>

< / td>
< / tr>< / TABLE>
< / ItemTemplate>
< / ASP:DataList>

< table align = right>
< tr>< td>

< a id = btnForward href ="#"
onMouseOut = " bforward.src =''images / bforward.gif'';"
onMouseOver =" bforward.src =''images / bforward_f2.gif'';"
runat = server onclick =" return validate();">< IMG
SRC =" images / bforward.gif" ALT ="" NAME =" bforward"
ID =" bforward" WIDTH =" 78" HEIGHT =" 24英寸; BORDER =" 0">< / A>

< / td>< / tr>< / table>

我想要检索问题ID和答案
(用户输入)同时点击按钮。

问卷是分页的,这是我使用的唯一形式。

后面的代码看起来有点像这样:

Sub Page_Load(ByVal Sender As Object,ByVal E As
EventArgs)

Dim oDt as DataTable
Dim oQuestion As Question(''这是我的业务层中的

oQuestion =新问题

Questions.DataSource =新DataView(oDt)
Questions.DataBind()

结束子

我如何获得问题和用户输入
插入数据库。可以有子请求





I have been posting this question for the past 2 weeks and
there wasn''t any response. I really don''t understand why I
am not getting any responses. Does my question sound very
stupid? Anyway, here I am asking again. Someone please
please help me!!

How do I add a radiobuttonlist within a datalist
programatically.

My actual problem is with retrieving the user-input and
the form values at the same time.
I have a datalist control in my aspx page(this is
paginated and everytime submits to itself). I am
calling a function within my datalist that returns a html
control (radio button ) in the form of the string. I also
have asp server controls(labels) in the datalist. When
the form is processed, I am retrieving the values of the
radio buttons through Request.form. To retrieve the values
of the asp server controls , I am using FindControl
method. But this is written in the Page_Load method, so
it returns the values of the current page before the page
gets submitted. I want the values after the page gets
submitted. How do I retrieve them.
If I use onserverclick on my button (which is a html
control with rollover capability <a href>) , the
onclick doesn''t work fine for validating the html
controls. I don''t have runat=server on my form tag when I
have onclick attribute on the button. I am new to
asp.net. I am not able to use both onclick and
onserverclick at the same time. Why is it so..

Please help!!

<form id="frmQuestion" method="post" >

<ASP:DataList id="Questions" ShowHeader="false"
ShowFooter="false" runat="server" >
<ItemTemplate>
<TABLE ALIGN="left" >
<td>

<asp:Label runat="server" Text=''<%# DataBinder.Eval
(Container.DataItem, "MainQuestion_ID")%> ''
ID="QuestionID" NAME="QuestionID">
</asp:Label>

</td>

<td>

<asp:Label runat="server" Text=''<%# DataBinder.Eval
(Container.DataItem, "MainQuestion_Txt")%>''
ID="QuestionTxt" NAME="QuestionTxt">
</asp:Label>

</td>

<td >

<%# DisplayAnswers(DataBinder.Eval
(Container.DataItem, "MainQuestion_ID"),DataBinder.Eval
(Container.DataItem, "QuestionTypeID")) %>

</td>
</tr></TABLE>
</ItemTemplate>
</ASP:DataList>

<table align=right >
<tr><td>

<a id=btnForward href="#"
onMouseOut="bforward.src=''images/bforward.gif'';"
onMouseOver="bforward.src=''images/bforward_f2.gif'';"
runat=server onclick="return validate();"><IMG
SRC="images/bforward.gif" ALT="" NAME="bforward"
ID="bforward" WIDTH="78" HEIGHT="24" BORDER="0"></A>

</td></tr></table>
I would like to retrieve the question id and the answer
(user-input) at the same time on click of the button.
The
questionaire is paginated and this is the only form i am
using.

The code behind looks somewhat this way:

Sub Page_Load(ByVal Sender As Object, ByVal E As
EventArgs)
Dim oDt As DataTable
Dim oQuestion As Question (''This is the
class
in my business layer)
oQuestion = New Question

Questions.DataSource = New DataView(oDt)
Questions.DataBind()

End Sub
how do I get questionid''s and user-input to
insert into the database. There can be subquestions

解决方案

Ani,

You need to set up your controls to use runat=server. Then in your page load
use:
If Not IsPostBack so that the controls will only be set up the first time.

Now on postback of the form the controls values won''t be overwritten when
you get them via FindControl.

I hope this helps.

(I haven''t taken a look at the forum in the past two weeks, I''ve been
working on a large project, or I would have answered you.)
Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"ani" <an*******@discussions.microsoft.com> wrote in message
news:0f****************************@phx.gbl...

I have been posting this question for the past 2 weeks and
there wasn''t any response. I really don''t understand why I
am not getting any responses. Does my question sound very
stupid? Anyway, here I am asking again. Someone please
please help me!!

How do I add a radiobuttonlist within a datalist
programatically.

My actual problem is with retrieving the user-input and
the form values at the same time.
I have a datalist control in my aspx page(this is
paginated and everytime submits to itself). I am
calling a function within my datalist that returns a html
control (radio button ) in the form of the string. I also
have asp server controls(labels) in the datalist. When
the form is processed, I am retrieving the values of the
radio buttons through Request.form. To retrieve the values
of the asp server controls , I am using FindControl
method. But this is written in the Page_Load method, so
it returns the values of the current page before the page
gets submitted. I want the values after the page gets
submitted. How do I retrieve them.
If I use onserverclick on my button (which is a html
control with rollover capability <a href>) , the
onclick doesn''t work fine for validating the html
controls. I don''t have runat=server on my form tag when I
have onclick attribute on the button. I am new to
asp.net. I am not able to use both onclick and
onserverclick at the same time. Why is it so..

Please help!!

<form id="frmQuestion" method="post" >

<ASP:DataList id="Questions" ShowHeader="false"
ShowFooter="false" runat="server" >
<ItemTemplate>
<TABLE ALIGN="left" >
<td>

<asp:Label runat="server" Text=''<%# DataBinder.Eval
(Container.DataItem, "MainQuestion_ID")%> ''
ID="QuestionID" NAME="QuestionID">
</asp:Label>

</td>

<td>

<asp:Label runat="server" Text=''<%# DataBinder.Eval
(Container.DataItem, "MainQuestion_Txt")%>''
ID="QuestionTxt" NAME="QuestionTxt">
</asp:Label>

</td>

<td >

<%# DisplayAnswers(DataBinder.Eval
(Container.DataItem, "MainQuestion_ID"),DataBinder.Eval
(Container.DataItem, "QuestionTypeID")) %>

</td>
</tr></TABLE>
</ItemTemplate>
</ASP:DataList>

<table align=right >
<tr><td>

<a id=btnForward href="#"
onMouseOut="bforward.src=''images/bforward.gif'';"
onMouseOver="bforward.src=''images/bforward_f2.gif'';"
runat=server onclick="return validate();"><IMG
SRC="images/bforward.gif" ALT="" NAME="bforward"
ID="bforward" WIDTH="78" HEIGHT="24" BORDER="0"></A>

</td></tr></table>
I would like to retrieve the question id and the answer
(user-input) at the same time on click of the button.
The
questionaire is paginated and this is the only form i am
using.

The code behind looks somewhat this way:

Sub Page_Load(ByVal Sender As Object, ByVal E As
EventArgs)
Dim oDt As DataTable
Dim oQuestion As Question (''This is the
class
in my business layer)
oQuestion = New Question

Questions.DataSource = New DataView(oDt)
Questions.DataBind()

End Sub
how do I get questionid''s and user-input to
insert into the database. There can be subquestions



To add a button to your list, add code like this to your itemdatabound
e.item.cells[0].Controls.Add(new radiobuttonlist())

actually you should create your radiobutton outside, give it an ID, set its
value and then add it.
When you want to check the selection in the post, just do a find control on
the id and examine the selection property.

Does that help?

PS. I didn''t see this post, i would have replied sooner. It''s easier if you
give your questions a good subject so they have a better chance of catching
someone''s attention

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"ani" <an*******@discussions.microsoft.com> wrote in message
news:0f****************************@phx.gbl...

I have been posting this question for the past 2 weeks and
there wasn''t any response. I really don''t understand why I
am not getting any responses. Does my question sound very
stupid? Anyway, here I am asking again. Someone please
please help me!!

How do I add a radiobuttonlist within a datalist
programatically.

My actual problem is with retrieving the user-input and
the form values at the same time.
I have a datalist control in my aspx page(this is
paginated and everytime submits to itself). I am
calling a function within my datalist that returns a html
control (radio button ) in the form of the string. I also
have asp server controls(labels) in the datalist. When
the form is processed, I am retrieving the values of the
radio buttons through Request.form. To retrieve the values
of the asp server controls , I am using FindControl
method. But this is written in the Page_Load method, so
it returns the values of the current page before the page
gets submitted. I want the values after the page gets
submitted. How do I retrieve them.
If I use onserverclick on my button (which is a html
control with rollover capability <a href>) , the
onclick doesn''t work fine for validating the html
controls. I don''t have runat=server on my form tag when I
have onclick attribute on the button. I am new to
asp.net. I am not able to use both onclick and
onserverclick at the same time. Why is it so..

Please help!!

<form id="frmQuestion" method="post" >

<ASP:DataList id="Questions" ShowHeader="false"
ShowFooter="false" runat="server" >
<ItemTemplate>
<TABLE ALIGN="left" >
<td>

<asp:Label runat="server" Text=''<%# DataBinder.Eval
(Container.DataItem, "MainQuestion_ID")%> ''
ID="QuestionID" NAME="QuestionID">
</asp:Label>

</td>

<td>

<asp:Label runat="server" Text=''<%# DataBinder.Eval
(Container.DataItem, "MainQuestion_Txt")%>''
ID="QuestionTxt" NAME="QuestionTxt">
</asp:Label>

</td>

<td >

<%# DisplayAnswers(DataBinder.Eval
(Container.DataItem, "MainQuestion_ID"),DataBinder.Eval
(Container.DataItem, "QuestionTypeID")) %>

</td>
</tr></TABLE>
</ItemTemplate>
</ASP:DataList>

<table align=right >
<tr><td>

<a id=btnForward href="#"
onMouseOut="bforward.src=''images/bforward.gif'';"
onMouseOver="bforward.src=''images/bforward_f2.gif'';"
runat=server onclick="return validate();"><IMG
SRC="images/bforward.gif" ALT="" NAME="bforward"
ID="bforward" WIDTH="78" HEIGHT="24" BORDER="0"></A>

</td></tr></table>
I would like to retrieve the question id and the answer
(user-input) at the same time on click of the button.
The
questionaire is paginated and this is the only form i am
using.

The code behind looks somewhat this way:

Sub Page_Load(ByVal Sender As Object, ByVal E As
EventArgs)
Dim oDt As DataTable
Dim oQuestion As Question (''This is the
class
in my business layer)
oQuestion = New Question

Questions.DataSource = New DataView(oDt)
Questions.DataBind()

End Sub
how do I get questionid''s and user-input to
insert into the database. There can be subquestions



Ani,

It sounds as if you don''t fully understand the differences between classic
asp and .net.

You are correct. If you are simply having a function output raw html to the
page then you can not use the runat=server tag.

The runat=server tag goes inside a control''s tags in the .aspx file and
means that the control it is attached to will be evaluated by the server
before it is delivered to the client.

You should take a look at the sample code provided in the tutorials here:

http://samples.gotdotnet.com/quickstart/aspplus/

These tutorials will give you the knowledge you need to understand how .net
works.

Best of luck!

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"ani" <an*******@discussions.microsoft.com> wrote in message
news:0c****************************@phx.gbl...

Thanks for the reply. I''ll try out as said. If I use runat
attribute, the javascript doesn''t work. That''s the
problem. How do I make both the javascript and
onserverclick event work . The javascript validates the
html controls. By the way, can I have both asp server
controls and html controls, the way that I coded below.
The html controls are returned in the form of the string
from a function. I guess even if I use runat=server on my
controls, it really makes no difference, because the html
control is a text string returned to the page. And , I
cannot have runat=server on the form tag, because my
javascript isn''t functioning properly if I use it.
Could you please suggest something else..

Thanks again for the posts.

P.S People are very curious if I say ''IS THERE NO ONE TO
HELP ME'' as opposed to the subject being ''cannot use
onserverclick and onclick the same time'' :-)

-----Original Message-----
Ani,

You need to set up your controls to use runat=server.


Then in your page load

use:
If Not IsPostBack so that the controls will only be set


up the first time.


Now on postback of the form the controls values won''t be


overwritten when

you get them via FindControl.

I hope this helps.

(I haven''t taken a look at the forum in the past two


weeks, I''ve been

working on a large project, or I would have answered you.)
Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"ani" <an*******@discussions.microsoft.com> wrote in


message

news:0f****************************@phx.gbl...

I have been posting this question for the past 2 weeks and there wasn''t any response. I really don''t understand why I am not getting any responses. Does my question sound very stupid? Anyway, here I am asking again. Someone please
please help me!!

How do I add a radiobuttonlist within a datalist
programatically.

My actual problem is with retrieving the user-input and
the form values at the same time.
I have a datalist control in my aspx page(this is
paginated and everytime submits to itself). I am
calling a function within my datalist that returns a html control (radio button ) in the form of the string. I also have asp server controls(labels) in the datalist. When
the form is processed, I am retrieving the values of the
radio buttons through Request.form. To retrieve the values of the asp server controls , I am using FindControl
method. But this is written in the Page_Load method, so
it returns the values of the current page before the page gets submitted. I want the values after the page gets
submitted. How do I retrieve them.
If I use onserverclick on my button (which is a html
control with rollover capability <a href>) , the
onclick doesn''t work fine for validating the html
controls. I don''t have runat=server on my form tag when I have onclick attribute on the button. I am new to
asp.net. I am not able to use both onclick and
onserverclick at the same time. Why is it so..

Please help!!

<form id="frmQuestion" method="post" >

<ASP:DataList id="Questions" ShowHeader="false"
ShowFooter="false" runat="server" >
<ItemTemplate>
<TABLE ALIGN="left" >
<td>

<asp:Label runat="server" Text=''<%# DataBinder.Eval
(Container.DataItem, "MainQuestion_ID")%> ''
ID="QuestionID" NAME="QuestionID">
</asp:Label>

</td>

<td>

<asp:Label runat="server" Text=''<%# DataBinder.Eval
(Container.DataItem, "MainQuestion_Txt")%>''
ID="QuestionTxt" NAME="QuestionTxt">
</asp:Label>

</td>

<td >

<%# DisplayAnswers(DataBinder.Eval
(Container.DataItem, "MainQuestion_ID"),DataBinder.Eval
(Container.DataItem, "QuestionTypeID")) %>

</td>
</tr></TABLE>
</ItemTemplate>
</ASP:DataList>

<table align=right >
<tr><td>

<a id=btnForward href="#"
onMouseOut="bforward.src=''images/bforward.gif'';"
onMouseOver="bforward.src=''images/bforward_f2.gif'';"
runat=server onclick="return validate();"><IMG
SRC="images/bforward.gif" ALT="" NAME="bforward"
ID="bforward" WIDTH="78" HEIGHT="24" BORDER="0"></A>

</td></tr></table>
I would like to retrieve the question id and the answer
(user-input) at the same time on click of the button.
The
questionaire is paginated and this is the only form i am
using.

The code behind looks somewhat this way:

Sub Page_Load(ByVal Sender As Object, ByVal E As
EventArgs)
Dim oDt As DataTable
Dim oQuestion As Question (''This is the
class
in my business layer)
oQuestion = New Question

Questions.DataSource = New DataView(oDt)
Questions.DataBind()

End Sub
how do I get questionid''s and user-input to
insert into the database. There can be subquestions


.



这篇关于那么,我认为没有人能解决这个问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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