Thursday, March 29, 2012
pass null values
parameters on the web form or only select a few. If the user does not select
a value to search on, how can I pass that to stored procedure and get data
back?
example form:
the user can search on
first name
last name
hire date
termination date
if they only know the first and last name, how can i get data back if the
dates are not entered?see DBNull class
-- bruce (sqlwork.com)
"NuB" <me@.me.com> wrote in message
news:Od3vppMAGHA.2788@.TK2MSFTNGP14.phx.gbl...
>I have a web form that allows a user to do a search, they can select all
>the parameters on the web form or only select a few. If the user does not
>select a value to search on, how can I pass that to stored procedure and
>get data back?
> example form:
> the user can search on
> first name
> last name
> hire date
> termination date
> if they only know the first and last name, how can i get data back if the
> dates are not entered?
>
>
Pass one variable from one form to other
I want to transfer the value of one variable ( basicaly text of a text filed) from one form to other form ...
i tried Server.Transfer("next_form.aspx") ..and then tried Request.Form("text_field") to retrieve it's content .. but doesnt work ...
i also tried Response.Redirect("next_form.aspx") ..and then tried Request.Form("text_field") to retrieve it's content .. but doesnt work ...
I think i am doing it wrong ... how can i do it .. anyone plz help :(
Thanks
imranIn your first form, put the following in your sub that gets called when you submit the form...
Response.Redirect("form2.aspx?myValue=" & myTextBox.Text)
Then in your second page...
Sub Page_Load()
TextBox2.Text = Request.QueryString("myValue")
End Sub
Hi,
When using Server.Transfer its preserveForm arguement to TRUE. This makes viewstate, event procedure available in destination form.
When using Response.Redirect, you can use querystring to pass information to the destination form like Response.Redirect("test.aspx?id=10");
HTH,
Shamir
Also see below article it could helps you
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconpassingservercontrolvaluesbetweenpages.asp
Pass Parameter As DataGridItemEventArgs
calls a sub named 'BindData'. This sub first finds a Label which exists
in the ItemTemplate of the TemplateColumn of the DataGrid & does some
work with the Label.
Sub BindData(obj As Object, ea As DataGridItemEventArgs)
Dim lbl As Label
If (ea.Item.ItemType = ListItemType.Item Or ea.Item.ItemType =
ListItemType.AlternatingItem) Then
lbl = ea.Item.FindControl("lblAcre")
...
...
End If
End Sub
The Button has the Click event which invokes a sub named 'SubmitPage'.
Sub SubmitPage(obj As Object, ea As EventArgs)
...
End Sub
Now I did like the 'SubmitPage' sub to invoke the 'BindData' sub. How
do I accomplish this? In other words, what parameters do I pass from
the 'SubmitPage' sub to the 'BindData' sub which the latter expects?You can't get DataGridItemEventArgs in SubmitPage (it is event argument data
type specific to a event, so it's not even wise to use as input to a
method), but you can loop through the DataGrid manually.
Sub SubmitPage(obj As Object, ea As EventArgs)
For each dgitem As DataGridItem in DataGrid1.Items
Dim lbl As Label=Nothing
If (dgitem.ItemType = ListItemType.Item Or dgitem.ItemType =
ListItemType.AlternatingItem) Then
lbl = dgitem.FindControl("lblAcre")
'Do something with the Label
End If
Next
End Sub
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
<rn5a@.rediffmail.com> wrote in message
news:1165068166.263744.157190@.l12g2000cwl.googlegroups.com...
>A Form has a DataGrid & a Button. The DataGrid's ItemDataBound event
> calls a sub named 'BindData'. This sub first finds a Label which exists
> in the ItemTemplate of the TemplateColumn of the DataGrid & does some
> work with the Label.
> Sub BindData(obj As Object, ea As DataGridItemEventArgs)
> Dim lbl As Label
> If (ea.Item.ItemType = ListItemType.Item Or ea.Item.ItemType =
> ListItemType.AlternatingItem) Then
> lbl = ea.Item.FindControl("lblAcre")
> ....
> ....
> End If
> End Sub
> The Button has the Click event which invokes a sub named 'SubmitPage'.
> Sub SubmitPage(obj As Object, ea As EventArgs)
> ....
> End Sub
> Now I did like the 'SubmitPage' sub to invoke the 'BindData' sub. How
> do I accomplish this? In other words, what parameters do I pass from
> the 'SubmitPage' sub to the 'BindData' sub which the latter expects?
>
Thanks, Teemu...that's exactly what I was looking out for
Teemu Keiski wrote:
> You can't get DataGridItemEventArgs in SubmitPage (it is event argument da
ta
> type specific to a event, so it's not even wise to use as input to a
> method), but you can loop through the DataGrid manually.
> Sub SubmitPage(obj As Object, ea As EventArgs)
>
> For each dgitem As DataGridItem in DataGrid1.Items
> Dim lbl As Label=Nothing
> If (dgitem.ItemType = ListItemType.Item Or dgitem.ItemType =
> ListItemType.AlternatingItem) Then
> lbl = dgitem.FindControl("lblAcre")
> 'Do something with the Label
> End If
> Next
> End Sub
>
> --
> Teemu Keiski
> ASP.NET MVP, AspInsider
> Finland, EU
> http://blogs.aspadvice.com/joteke
> <rn5a@.rediffmail.com> wrote in message
> news:1165068166.263744.157190@.l12g2000cwl.googlegroups.com...
Pass Parameter As DataGridItemEventArgs
calls a sub named 'BindData'. This sub first finds a Label which exists
in the ItemTemplate of the TemplateColumn of the DataGrid & does some
work with the Label.
Sub BindData(obj As Object, ea As DataGridItemEventArgs)
Dim lbl As Label
If (ea.Item.ItemType = ListItemType.Item Or ea.Item.ItemType =
ListItemType.AlternatingItem) Then
lbl = ea.Item.FindControl("lblAcre")
....
....
End If
End Sub
The Button has the Click event which invokes a sub named 'SubmitPage'.
Sub SubmitPage(obj As Object, ea As EventArgs)
....
End Sub
Now I did like the 'SubmitPage' sub to invoke the 'BindData' sub. How
do I accomplish this? In other words, what parameters do I pass from
the 'SubmitPage' sub to the 'BindData' sub which the latter expects?You can't get DataGridItemEventArgs in SubmitPage (it is event argument data
type specific to a event, so it's not even wise to use as input to a
method), but you can loop through the DataGrid manually.
Sub SubmitPage(obj As Object, ea As EventArgs)
For each dgitem As DataGridItem in DataGrid1.Items
Dim lbl As Label=Nothing
If (dgitem.ItemType = ListItemType.Item Or dgitem.ItemType =
ListItemType.AlternatingItem) Then
lbl = dgitem.FindControl("lblAcre")
'Do something with the Label
End If
Next
End Sub
--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
<rn5a@.rediffmail.comwrote in message
news:1165068166.263744.157190@.l12g2000cwl.googlegr oups.com...
Quote:
Originally Posted by
>A Form has a DataGrid & a Button. The DataGrid's ItemDataBound event
calls a sub named 'BindData'. This sub first finds a Label which exists
in the ItemTemplate of the TemplateColumn of the DataGrid & does some
work with the Label.
>
Sub BindData(obj As Object, ea As DataGridItemEventArgs)
Dim lbl As Label
>
If (ea.Item.ItemType = ListItemType.Item Or ea.Item.ItemType =
ListItemType.AlternatingItem) Then
lbl = ea.Item.FindControl("lblAcre")
....
....
End If
End Sub
>
The Button has the Click event which invokes a sub named 'SubmitPage'.
>
Sub SubmitPage(obj As Object, ea As EventArgs)
....
End Sub
>
Now I did like the 'SubmitPage' sub to invoke the 'BindData' sub. How
do I accomplish this? In other words, what parameters do I pass from
the 'SubmitPage' sub to the 'BindData' sub which the latter expects?
>
Thanks, Teemu...that's exactly what I was looking out for
Teemu Keiski wrote:
Quote:
Originally Posted by
You can't get DataGridItemEventArgs in SubmitPage (it is event argument data
type specific to a event, so it's not even wise to use as input to a
method), but you can loop through the DataGrid manually.
>
Sub SubmitPage(obj As Object, ea As EventArgs)
>
>
For each dgitem As DataGridItem in DataGrid1.Items
>
Dim lbl As Label=Nothing
>
If (dgitem.ItemType = ListItemType.Item Or dgitem.ItemType =
ListItemType.AlternatingItem) Then
lbl = dgitem.FindControl("lblAcre")
'Do something with the Label
End If
>
Next
>
End Sub
>
>
--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
>
<rn5a@.rediffmail.comwrote in message
news:1165068166.263744.157190@.l12g2000cwl.googlegr oups.com...
Quote:
Originally Posted by
A Form has a DataGrid & a Button. The DataGrid's ItemDataBound event
calls a sub named 'BindData'. This sub first finds a Label which exists
in the ItemTemplate of the TemplateColumn of the DataGrid & does some
work with the Label.
Sub BindData(obj As Object, ea As DataGridItemEventArgs)
Dim lbl As Label
If (ea.Item.ItemType = ListItemType.Item Or ea.Item.ItemType =
ListItemType.AlternatingItem) Then
lbl = ea.Item.FindControl("lblAcre")
....
....
End If
End Sub
The Button has the Click event which invokes a sub named 'SubmitPage'.
Sub SubmitPage(obj As Object, ea As EventArgs)
....
End Sub
Now I did like the 'SubmitPage' sub to invoke the 'BindData' sub. How
do I accomplish this? In other words, what parameters do I pass from
the 'SubmitPage' sub to the 'BindData' sub which the latter expects?
Monday, March 26, 2012
pass the control value from one web form to another form
I want to pass the selectedDate value from my calender
form to another web form or a web user control. Could you
please show me how to do this?
Thanks in advance.Tom,
There are a number of choices to do so.
Depending on your needs, you could use Server.Transfer or Response.Redirect
and the query string.
To use the query string
Response.Redirect("pagetwo.aspx?date=" & selectedDate.ToString)
Then on page two:
Dim Date As Date = CType(Request.Querystring.Item("date"), Date)
If you want to use Server.Transfer (Which would be more suited if a number
of variables need to be passed to the second page.) I suggest reading up on
it a bit more. It's fairly easy to do, but can be confusing for the user
because they are moved to page two but their browser's address bar will
still display the first page's url.
If you want some quick code samples I have some in the code library of my
web site: www.aboutfortunate.com. Just use the search box in the code
library area and input: "Server.Transfer".
Sincerely,
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
"tom" <anonymous@.discussions.microsoft.com> wrote in message
news:00d201c3a947$75660be0$a401280a@.phx.gbl...
> Hi Experts,
> I want to pass the selectedDate value from my calender
> form to another web form or a web user control. Could you
> please show me how to do this?
> Thanks in advance.
Here's a nice, simple way to pass values from one page to another:
(VB.NET code)
'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")
Then, in WebForm2.aspx:
'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)
Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc.
You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/i...te/default.aspx
http://www.aspalliance.com/kenc/passval.aspx
http://www.dotnetjunkies.com/tutori...?tutorialid=600
http://www.dotnetbips.com/displayarticle.aspx?id=79
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com
"tom" <anonymous@.discussions.microsoft.com> wrote in message
news:00d201c3a947$75660be0$a401280a@.phx.gbl...
> Hi Experts,
> I want to pass the selectedDate value from my calender
> form to another web form or a web user control. Could you
> please show me how to do this?
> Thanks in advance.
Hi Steve and S. Justin,
Thank you very much for your responses. I'm sorry that I
didn't explain my problem more clearly on my previous
mail. My problem is a different situation. On my page one
there is textbox and the page two only contains a calendar
control. I need to open page one first and click a button
on page one will open the page two. After user selected a
date from the calendar the page two will close and the
date should be shown on the page one's textbox. I'm
struggling with how to pass value back to page one when
the page one is already opened and update page one's data?
Please help me!
Thanks in advance.
>--Original Message--
>Here's a nice, simple way to pass values from one page to
another:
>(VB.NET code)
>'Add data to the context object before transferring
>Context.Items("myParameter") = x
>Server.Transfer("WebForm2.aspx")
>Then, in WebForm2.aspx:
>'Grab data from the context property
>Dim x as Integer = CType(Context.Items
("myParameter"),Integer)
>Of course there are a number of ways to pass values from
one page to
>another, such as using the querystring, cookies, session,
>context, saving to a temporary table in the database
between each page, etc.
>You'll have to decide which technique is best for your
application.
>Here are several good articles on the subject to help you
decide.
>http://msdn.microsoft.com/msdnmag/i.../04/ASPNETUserS
tate/default.aspx
>http://www.aspalliance.com/kenc/passval.aspx
>http://www.dotnetjunkies.com/tutori...?tutorialid=600
>http://www.dotnetbips.com/displayarticle.aspx?id=79
>--
>I hope this helps,
>Steve C. Orr, MCSD, MVP
>http://Steve.Orr.net
>Hire top-notch developers at http://www.able-
consulting.com
>
>"tom" <anonymous@.discussions.microsoft.com> wrote in
message
>news:00d201c3a947$75660be0$a401280a@.phx.gbl...
>> Hi Experts,
>>
>> I want to pass the selectedDate value from my calender
>> form to another web form or a web user control. Could
you
>> please show me how to do this?
>>
>> Thanks in advance.
>>
>
>.
Tom,
I think this article is just what you need:
http://www.vb2themax.com/Item.asp?PageID=TipBank&ID=614
Sincerely,
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
"tom" <anonymous@.discussions.microsoft.com> wrote in message
news:0e5401c3a9ee$cd69a7f0$a301280a@.phx.gbl...
> Hi Steve and S. Justin,
> Thank you very much for your responses. I'm sorry that I
> didn't explain my problem more clearly on my previous
> mail. My problem is a different situation. On my page one
> there is textbox and the page two only contains a calendar
> control. I need to open page one first and click a button
> on page one will open the page two. After user selected a
> date from the calendar the page two will close and the
> date should be shown on the page one's textbox. I'm
> struggling with how to pass value back to page one when
> the page one is already opened and update page one's data?
> Please help me!
> Thanks in advance.
> >--Original Message--
> >Here's a nice, simple way to pass values from one page to
> another:
> >(VB.NET code)
> >'Add data to the context object before transferring
> >Context.Items("myParameter") = x
> >Server.Transfer("WebForm2.aspx")
> >Then, in WebForm2.aspx:
> >'Grab data from the context property
> >Dim x as Integer = CType(Context.Items
> ("myParameter"),Integer)
> >Of course there are a number of ways to pass values from
> one page to
> >another, such as using the querystring, cookies, session,
> >context, saving to a temporary table in the database
> between each page, etc.
> >You'll have to decide which technique is best for your
> application.
> >Here are several good articles on the subject to help you
> decide.
> >http://msdn.microsoft.com/msdnmag/i.../04/ASPNETUserS
> tate/default.aspx
> >http://www.aspalliance.com/kenc/passval.aspx
> >http://www.dotnetjunkies.com/tutori...?tutorialid=600
> >http://www.dotnetbips.com/displayarticle.aspx?id=79
> >--
> >I hope this helps,
> >Steve C. Orr, MCSD, MVP
> >http://Steve.Orr.net
> >Hire top-notch developers at http://www.able-
> consulting.com
> >"tom" <anonymous@.discussions.microsoft.com> wrote in
> message
> >news:00d201c3a947$75660be0$a401280a@.phx.gbl...
> >> Hi Experts,
> >>
> >> I want to pass the selectedDate value from my calender
> >> form to another web form or a web user control. Could
> you
> >> please show me how to do this?
> >>
> >> Thanks in advance.
> >>
> >.
pass through value of DropDownList ListItem into a string
I'm building an email form that uses a DropDownList to select the e-mail address via alias. Here is a portion of the control:
<asp:DropDownList id="ddlRecipient" CssClass="text-blue" AutoPostBack="true" runat="server">
<asp:ListItem Value="none" Selected="true">Please select from this list.</asp:ListItem>
<asp:ListItem Value="mornings">the morning show</asp:ListItem>
<asp:ListItem Value="news">News - newscasts, stories, comments</asp:ListItem>
</asp:DropDownList
Here is the code I am supposedly using to pass through the value:
Sub SendMe ()
Dim ddlRecipient As String
Dim ddlRecipientEmail As String = ddlRecipient & "@dotnet.itags.org.mydomain.com"
Response.Write(ddlRecipientEmail & " -- this is the email address you just sent")
End Sub
(The Response.Write line will be replaced by my email generation code, and I will use ddlRecipientEmail as the "from" field.)
However, all I get from the Response.Write is:
@dotnet.itags.org.mydomain.com -- this is the email address you just sent
So it's not passing through the value. How do I get it to do that?
Also, I'm going to do an If/Then/Else statement that, if "none" is the value, you get a popup and the program stops running. Anyone got a quick way to do that?
Appreciate the help.
ddlRecipient.SELECTEDVALUE
I actually just found that and it is working now.Thank you.
Curt_C:
ddlRecipient.SELECTEDVALUE
Saturday, March 24, 2012
Pass variable to another page
Using the GET method, I would like to pass the date as a variable to another
asp page. How do I do this?
Thanks.Hi Marti,
Not sure if I understand your question. But in ASP.Net 2.0 you have to
ability to do cross-page positing. So you can just do a postback with
value of that textbox to your other page.
More info:
http://www.dotnetjohn.com/articles.aspx?articleid=176
http://msdn2.microsoft.com/en-us/library/ms178139.aspx
Ward Bekker
"Asp.Net Discussions for the Professional Developer"
http://www.dotnettaxi.com
"Free .Net 2.0 C# to/from VB.Net Code Converter"
http://www.dotnettaxi.com/Tools/Converter.aspx
Marti wrote:
> I have a calendar form that sends the inputted date back to a text box .
> Using the GET method, I would like to pass the date as a variable to anoth
er
> asp page. How do I do this?
> Thanks.
>
Ward,
Thanks - That's exactly what I was looking for. I was using a different
method to pass values. I have tried using the postback method but to no
avail. Below is the source page I am working with, can you tell me what I
should have on my target page?
Thanks.
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Cross Page PostBack</title>
</head>
<body>
<form name="form1" id="form1" runat="server">
<h3>Cross Page PostBack</h3>
Enter Search Term:
<asp:TextBox ID="SearchTerm" runat="server" />
<asp:Button ID="Button2" runat="server" Text="Search"
PostBackUrl="posttarget.aspx" />
<br />
</form>
</body>
</html>
"Ward Bekker" <ward@.NOequanimitySPAM.nl> wrote in message
news:4405fc87$0$2027$9a622dc7@.news.kpnplanet.nl...
Hi Marti,
Not sure if I understand your question. But in ASP.Net 2.0 you have to
ability to do cross-page positing. So you can just do a postback with
value of that textbox to your other page.
More info:
http://www.dotnetjohn.com/articles.aspx?articleid=176
http://msdn2.microsoft.com/en-us/library/ms178139.aspx
Ward Bekker
"Asp.Net Discussions for the Professional Developer"
http://www.dotnettaxi.com
"Free .Net 2.0 C# to/from VB.Net Code Converter"
http://www.dotnettaxi.com/Tools/Converter.aspx
Marti wrote:
> I have a calendar form that sends the inputted date back to a text box .
> Using the GET method, I would like to pass the date as a variable to
another
> asp page. How do I do this?
> Thanks.
>
Ok, I think I know out the code isn't working. Don't have 2.0 installed.
I'll install the 2.0 framework and give the crosspage post back a try..
"Martin" <bmquiroz@.email.com> wrote in message
news:%23ItZRAYPGHA.3460@.TK2MSFTNGP15.phx.gbl...
Ward,
Thanks - That's exactly what I was looking for. I was using a different
method to pass values. I have tried using the postback method but to no
avail. Below is the source page I am working with, can you tell me what I
should have on my target page?
Thanks.
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Cross Page PostBack</title>
</head>
<body>
<form name="form1" id="form1" runat="server">
<h3>Cross Page PostBack</h3>
Enter Search Term:
<asp:TextBox ID="SearchTerm" runat="server" />
<asp:Button ID="Button2" runat="server" Text="Search"
PostBackUrl="posttarget.aspx" />
<br />
</form>
</body>
</html>
"Ward Bekker" <ward@.NOequanimitySPAM.nl> wrote in message
news:4405fc87$0$2027$9a622dc7@.news.kpnplanet.nl...
Hi Marti,
Not sure if I understand your question. But in ASP.Net 2.0 you have to
ability to do cross-page positing. So you can just do a postback with
value of that textbox to your other page.
More info:
http://www.dotnetjohn.com/articles.aspx?articleid=176
http://msdn2.microsoft.com/en-us/library/ms178139.aspx
Ward Bekker
"Asp.Net Discussions for the Professional Developer"
http://www.dotnettaxi.com
"Free .Net 2.0 C# to/from VB.Net Code Converter"
http://www.dotnettaxi.com/Tools/Converter.aspx
Marti wrote:
> I have a calendar form that sends the inputted date back to a text box .
> Using the GET method, I would like to pass the date as a variable to
another
> asp page. How do I do this?
> Thanks.
>
Pass variable to another page
Using the GET method, I would like to pass the date as a variable to another
asp page. How do I do this?
Thanks.Hi Marti,
Not sure if I understand your question. But in ASP.Net 2.0 you have to
ability to do cross-page positing. So you can just do a postback with
value of that textbox to your other page.
More info:
http://www.dotnetjohn.com/articles.aspx?articleid=176
http://msdn2.microsoft.com/en-us/library/ms178139.aspx
--
Ward Bekker
"Asp.Net Discussions for the Professional Developer"
http://www.dotnettaxi.com
"Free .Net 2.0 C# to/from VB.Net Code Converter"
http://www.dotnettaxi.com/Tools/Converter.aspx
Marti wrote:
> I have a calendar form that sends the inputted date back to a text box .
> Using the GET method, I would like to pass the date as a variable to another
> asp page. How do I do this?
> Thanks.
Ward,
Thanks - That's exactly what I was looking for. I was using a different
method to pass values. I have tried using the postback method but to no
avail. Below is the source page I am working with, can you tell me what I
should have on my target page?
Thanks.
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Cross Page PostBack</title>
</head
<body>
<form name="form1" id="form1" runat="server">
<h3>Cross Page PostBack</h3>
Enter Search Term:
<asp:TextBox ID="SearchTerm" runat="server" />
<asp:Button ID="Button2" runat="server" Text="Search"
PostBackUrl="posttarget.aspx" />
<br />
</form>
</body>
</html
"Ward Bekker" <ward@.NOequanimitySPAM.nl> wrote in message
news:4405fc87$0$2027$9a622dc7@.news.kpnplanet.nl...
Hi Marti,
Not sure if I understand your question. But in ASP.Net 2.0 you have to
ability to do cross-page positing. So you can just do a postback with
value of that textbox to your other page.
More info:
http://www.dotnetjohn.com/articles.aspx?articleid=176
http://msdn2.microsoft.com/en-us/library/ms178139.aspx
--
Ward Bekker
"Asp.Net Discussions for the Professional Developer"
http://www.dotnettaxi.com
"Free .Net 2.0 C# to/from VB.Net Code Converter"
http://www.dotnettaxi.com/Tools/Converter.aspx
Marti wrote:
> I have a calendar form that sends the inputted date back to a text box .
> Using the GET method, I would like to pass the date as a variable to
another
> asp page. How do I do this?
> Thanks.
Ok, I think I know out the code isn't working. Don't have 2.0 installed.
I'll install the 2.0 framework and give the crosspage post back a try..
"Martin" <bmquiroz@.email.com> wrote in message
news:%23ItZRAYPGHA.3460@.TK2MSFTNGP15.phx.gbl...
Ward,
Thanks - That's exactly what I was looking for. I was using a different
method to pass values. I have tried using the postback method but to no
avail. Below is the source page I am working with, can you tell me what I
should have on my target page?
Thanks.
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Cross Page PostBack</title>
</head
<body>
<form name="form1" id="form1" runat="server">
<h3>Cross Page PostBack</h3>
Enter Search Term:
<asp:TextBox ID="SearchTerm" runat="server" />
<asp:Button ID="Button2" runat="server" Text="Search"
PostBackUrl="posttarget.aspx" />
<br />
</form>
</body>
</html
"Ward Bekker" <ward@.NOequanimitySPAM.nl> wrote in message
news:4405fc87$0$2027$9a622dc7@.news.kpnplanet.nl...
Hi Marti,
Not sure if I understand your question. But in ASP.Net 2.0 you have to
ability to do cross-page positing. So you can just do a postback with
value of that textbox to your other page.
More info:
http://www.dotnetjohn.com/articles.aspx?articleid=176
http://msdn2.microsoft.com/en-us/library/ms178139.aspx
--
Ward Bekker
"Asp.Net Discussions for the Professional Developer"
http://www.dotnettaxi.com
"Free .Net 2.0 C# to/from VB.Net Code Converter"
http://www.dotnettaxi.com/Tools/Converter.aspx
Marti wrote:
> I have a calendar form that sends the inputted date back to a text box .
> Using the GET method, I would like to pass the date as a variable to
another
> asp page. How do I do this?
> Thanks.
Passing a "where" claus to populate a datagrid on another form.
It is my intention to open this form that contains a datagrid which returns the records that match their search criteria.
I have had success sending the information, but I am completely lost as to how I use this information.
I dragged the dbconnection, the dataadapter and created the dataset onto the form, but I am not sure if this is how I should have done it. Perhaps all of this should be done in code and create the select string in code for the dataadapter? Does anyone have code that they could share the accomplishes this?
Currently the form brings up all records, (before I started tinkering), but I do not know how to set the 'where' claus.
Thanks for your helpHere is some of the code I am working with:
Dim conn As New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=c:\Access_ResourceDB\Access_ResourceDb_Backend\ResourceDb_be.mdb")
Dim ds As New DataSet("MyDataSet")
Dim objCmd As New OleDbDataAdapter("Select RecId,Name,Age,Town,HowmPhone,Email FROM tblContacts " & "Where " & pasRecCrit & ";", conn)
conn.Open()
objCmd.Fill(ds, "MyDataSet")
Me.DataGrid1.DataSource = ds.Tables("MyDataSet")
Me.DataGrid1.DataBind()
This is just one of the ways I have tried. Right now I get an error stating that
"No value given for one or more required parameters", on the objCmd.fill line.
Thanks
What do have in the pasRecCrit variable? This looks like it should work. Maybe your Where clause isn't formatted correctly.
Wednesday, March 21, 2012
passing a label value from webform(.aspx) page to a vb6 form
I have a vb6 form which has a label on it. When they click on that label it
will display the new web form and ask them to fill details. Once they fill
details it will give confirmation number. Can i pass this confirmation numbe
r
back to windows form and display it using Message box?
please let me know
Thanks,
Sridhar.You can save the confirmation number to the database from the webform and
then have the VB6 Windows application query the database record for this
confirmation number then display it.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Sridhar" wrote:
> Hi,
> I have a vb6 form which has a label on it. When they click on that label
it
> will display the new web form and ask them to fill details. Once they fill
> details it will give confirmation number. Can i pass this confirmation num
ber
> back to windows form and display it using Message box?
> please let me know
> Thanks,
> Sridhar.
Hi,
I cannot do that because the database resides on the server. we install
this vb6 application on the client's computer and it does not have access to
the database.
Thanks,
Sridhar.
"Phillip Williams" wrote:
> You can save the confirmation number to the database from the webform and
> then have the VB6 Windows application query the database record for this
> confirmation number then display it.
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
> "Sridhar" wrote:
>
The VB6 app is launching a web page that is also on the server, correct? Tha
t
means the page gets processed server side and thus it can indeed access the
database if the proper connection string is supplied to it (suggested to
store the con string in the web.config file).
-Demetri
"Sridhar" wrote:
> Hi,
> I cannot do that because the database resides on the server. we install
> this vb6 application on the client's computer and it does not have access
to
> the database.
> Thanks,
> Sridhar.
> "Phillip Williams" wrote:
>
Never mind my last post, I was interpreting something else. Anyway, you can
have the vb6 app execute and parse the response of another web page who's
sole job is to get the new confirmation number and write it out for the vb6
app to parse.
Another solution would be the soap tool kit in the vb6 app and execute a web
service that returns the confirmation in xml.
Hope that gives you some ideas.
-Demetri
"Sridhar" wrote:
> Hi,
> I cannot do that because the database resides on the server. we install
> this vb6 application on the client's computer and it does not have access
to
> the database.
> Thanks,
> Sridhar.
> "Phillip Williams" wrote:
>
Passing a parameter to get results to post to a datagrid
here is my code:
<%@dotnet.itags.org. Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@dotnet.itags.org. Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %>
<MM:DataSet
id="DataSetResults"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_CPAR") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_CPAR") %>'
CommandText='<%# "SELECT * FROM dbo.ListofNonconformities WHERE ""Reference Document"" = ?" %>'
Debug="true" PageSize="10"
><Parameters>
<Parameter Name="@dotnet.itags.org.Reference Document" Value='<%# IIf((Request.Form("FRefDoc") <> Nothing), Request.Form("FRefDoc"), "") %>' Type="WChar" /></Parameters></MM:DataSet>
<MM:PageBind runat="server" PostBackBind="true" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<form action="" method="post" name="FRefDoc" id="FRefDoc" runat="server">
<p>
<% DDRefDoc.SelectedIndex = DDRefDoc.Items.IndexOf(DDRefDoc.Items.FindByValue(DataSetResults.FieldValue("Reference Document", Nothing) )) %><asp:DropDownList ID="DDRefDoc" runat="server" DataSource="<%# DataSetResults.DefaultView %>" DataTextField="Reference Document" DataValueField="Reference Document"></asp:DropDownList>
<asp:Button ID="BSubmit" runat="server" Text="Submit" /></p>
<p>
<asp:DataGrid id="DataGridResults"
runat="server"
AllowSorting="False"
AutoGenerateColumns="false"
CellPadding="3"
CellSpacing="0"
ShowFooter="false"
ShowHeader="true"
DataSource="<%# DataSetResults.DefaultView %>"
PagerStyle-Mode="NextPrev"
AllowPaging="true"
AllowCustomPaging="true"
PageSize="<%# DataSetResults.PageSize %>"
VirtualItemCount="<%# DataSetResults.RecordCount %>"
OnPageIndexChanged="DataSetResults.OnDataGridPageIndexChanged"
>
<HeaderStyle HorizontalAlign="center" BackColor="#E8EBFD" ForeColor="#3D3DB6" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Bold="true" Font-Size="smaller" />
<ItemStyle BackColor="#F2F2F2" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<AlternatingItemStyle BackColor="#E5E5E5" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<FooterStyle HorizontalAlign="center" BackColor="#E8EBFD" ForeColor="#3D3DB6" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Bold="true" Font-Size="smaller" />
<PagerStyle BackColor="white" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<Columns>
<asp:BoundColumn DataField="ISO 9001 Clause"
HeaderText="ISO 9001 Clause"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="Expr1"
HeaderText="Expr1"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="Action To:"
HeaderText="Action To:"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="Description of Nonconformity"
HeaderText="Description of Nonconformity"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="Verified By"
HeaderText="Verified By"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="Submission Date"
HeaderText="Submission Date"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="Completion Date"
HeaderText="Completion Date"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="Verification Date"
HeaderText="Verification Date"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="Reference Document"
HeaderText="Reference Document"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="Process Owner"
HeaderText="Process Owner"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="Remarks"
HeaderText="Remarks"
ReadOnly="true"
Visible="True"/>
</Columns>
</asp:DataGrid>
</p>
<p> </p>
</form>
</body>
</html>that is very good
thank you
Passing A Session Variable Form Page to Page ~ No Working
I am trying to passing a session variable from Page to Page but its not working!
the user basicaly logins in on the login.aspx and when their credentials are verifed by the MSSAccess database they are tehn redirected to the next page...heres a snip of code
~~~~~~~~~~~~~~
session("ID") = dslogin.tables("UserInfo").rows(0).item("ID")
response.redirect("./success.aspx")
~~~~~~~~~~~~~~~~~~
Heres the code for the page I am trying to access after beigng verifed
~~~~~~~~~~
sub page_load(byval sender as object, byval e as eventargs)
if Len(Session("ID")) = 0 then
response.redirect("./login.aspx")
end if
~~~~~~~~~~~~~~~
wots happeniong is even if you use the correct userid and password the code on the second page still sends you back to the login.aspx???
Can anyone please shine a light on this as I am going around in circles...
many thanks
Tony
end subHi Tony,
Any chance you are redirecting from https to http?
Hi & Thanks for your response
its all HTTP:
are you debugging to verify that your DataBase value is actually being inserted into Session upon logging in?
no ...but i would love to learn how......
Please can you tell me how to do this plase
I have this name sapce in
<%@. Page Language="VB" Debug="true" %
rgs
Tony
Hi,
Thanks for your help so far..
I think it is passing but now I am gettimng this error and I dont know what it means!!
Compiler Error Message: BC30545: Property access must assign to the property or use its value.
Source Error:
Line 7: sub page_load(byval sender as object, byval e as eventargs)
Line 8:
Line 9: request.querystring("UserID")
Line 10:
Line 11: if Len(Session("UserID")) = 0 then
any help would be most appreciated
rgs
Tony
You have to assign a variable to store the QueryString data, like:
dim foo as string = request.querystring("bar")
Are you using VS.NET and developing this app locally? If so you can just add a breakpoint to a line of code by pressing f9 and when that line is met, you can step through the code and hover you mouse over variables to see what they contain, or add them to the watch list.
Friday, March 16, 2012
passing a value to a hidden form field
Newbie Question:
I have a dataset called "mxdata" that has a field called "mxorder" with an integer value.
I want to increment that value by 1 and pass the new value to a hidden form field.
ie:
variablex = mxdata.mxorder + 1
<input name="ordervalue" type="hidden" id="ordervalue" value="<%# variablex %>"/
Obviously this is incorrect. Can someone show me how I would do this?why not just add it to the viewstate?, the ultimate hidden field of all time :-)
ViewState("orderValue") = mxdata.mxorder + 1
then after a postback you can retrive it like this
somevar = cint(ViewState("orderValue"))
Passing A Value To Server
The effect I want to accomplish is this:
The basic credit card fields are there and can be filled out. But if the
user swipes the card, I want to fill out the fields automatically and make
them read only. (So far I can do this.)
But I also want a checkbox to appear that indicates the card was swiped.
The user can clear the checkbox, re-enabling the fields so they can be
edited, but then I will no longer consider the data as being swiped. I want
the check box to disappear if they clear it.
Using server controls, if I create a checkbox, but make it not visible, then
it's not available at the client side to work with from client side code.
So I would need to send some flag back to the server to indicate a post back
and have the page re-rendered properly. But how do send info to the server
like that without having a visible control to attach the data to?
(Does this make any sense? Not sure if I'm explaining it well.)
Is there a way to send a value back to the server, in a postback, where the
data is not a property of a server control that's tracking viewstate? The
session object is only available on the server side right?
Any guidance here is appreciated. Thanks.
Jerryto send additional value to server , one commonly used method is
a HiddenControl (you will access it like Request.Forms["HiddenContrlName"]
from code behind)
or a TextBox Webcontrol with size 0 or attribute style='display:none' ..
But if the only purpose of post back is to display/check the checkbox ,
probabaly a better approach is to do the display/check in the client side
javascript ..
Instead of settign Visibility=False, you would just add an attribute to
make it hidden , but still available at client code
CheckBoxName.Attributes.Add("style='display:none'")
"Jerry Camel" wrote:
> Basic Web Form... A few text boxes and a checkbox - and a card reader...
> The effect I want to accomplish is this:
> The basic credit card fields are there and can be filled out. But if the
> user swipes the card, I want to fill out the fields automatically and make
> them read only. (So far I can do this.)
> But I also want a checkbox to appear that indicates the card was swiped.
> The user can clear the checkbox, re-enabling the fields so they can be
> edited, but then I will no longer consider the data as being swiped. I wa
nt
> the check box to disappear if they clear it.
> Using server controls, if I create a checkbox, but make it not visible, th
en
> it's not available at the client side to work with from client side code.
> So I would need to send some flag back to the server to indicate a post ba
ck
> and have the page re-rendered properly. But how do send info to the serve
r
> like that without having a visible control to attach the data to?
> (Does this make any sense? Not sure if I'm explaining it well.)
> Is there a way to send a value back to the server, in a postback, where th
e
> data is not a property of a server control that's tracking viewstate? The
> session object is only available on the server side right?
> Any guidance here is appreciated. Thanks.
> Jerry
>
>
Okay... I can have the checkbox on the form and available with 'Display:
None'...
But I can't seem to find the proper syntax to change the display state and
make it visible on the client side...
Thanks.
"Sreejith Ram" <SreejithRam@.discussions.microsoft.com> wrote in message
news:431FA795-5920-4B2C-81E1-98224CD89497@.microsoft.com...
> to send additional value to server , one commonly used method is
> a HiddenControl (you will access it like Request.Forms["HiddenContrlName"]
> from code behind)
> or a TextBox Webcontrol with size 0 or attribute style='display:none' ..
> But if the only purpose of post back is to display/check the checkbox ,
> probabaly a better approach is to do the display/check in the client side
> javascript ..
> Instead of settign Visibility=False, you would just add an attribute to
> make it hidden , but still available at client code
> CheckBoxName.Attributes.Add("style='display:none'")
>
> "Jerry Camel" wrote:
>
reader...
the
make
want
then
code.
back
server
the
The
Syntax to display ?
document.getElementById("CheckBoxClientName").style.display='' ;
document.getElementById("CheckBoxClientName").Checked = true;
this may help...
http://www.w3schools.com/htmldom/dom_obj_checkbox.asp
http://www.w3schools.com/htmldom/do...tyle.asp#layout
"Jerry Camel" wrote:
> Okay... I can have the checkbox on the form and available with 'Display:
> None'...
> But I can't seem to find the proper syntax to change the display state and
> make it visible on the client side...
> Thanks.
>
> "Sreejith Ram" <SreejithRam@.discussions.microsoft.com> wrote in message
> news:431FA795-5920-4B2C-81E1-98224CD89497@.microsoft.com...
> reader...
> the
> make
> want
> then
> code.
> back
> server
> the
> The
>
>
Thanks, but this doesn't seem to have any effect. I tried changing the
style.display property to all kinds of values, but the checkbox never
appears...
Jerry
"Sreejith Ram" <SreejithRam@.discussions.microsoft.com> wrote in message
news:514C006A-51EE-42B4-938C-506D452587A4@.microsoft.com...
> Syntax to display ?
> document.getElementById("CheckBoxClientName").style.display='' ;
> document.getElementById("CheckBoxClientName").Checked = true;
> this may help...
> http://www.w3schools.com/htmldom/dom_obj_checkbox.asp
> http://www.w3schools.com/htmldom/do...tyle.asp#layout
>
> "Jerry Camel" wrote:
>
'Display:
and
Request.Forms["HiddenContrlName"]
..
,
side
to
if
and
swiped.
be
I
visible,
post
where
viewstate?
Obviously there is some thing not right other than the syntax.. :) .. Is
there any javascript error when you call the function to display the
checkbox?...
if still no luck, you may want to create a simple HTML page with only
following code in it...
<INPUT TYPE=checkbox ID=chk1 style='display:hidden'>
<INPUT TYPE=button ID=btn1 onClick="toggle()" value="Click to Toggle
Display" >
<script>
function toggle(id)
{
el = document.getElementById("chk1");
var display = el.style.display ? '' : 'none';
el.style.display = display;
}
</script>
Once this works, you can compare with the HTML your aspx generated and that
may help in finding the issue..
This link got a working sample... with code...pls see if this helps..
http://www.sam-i-am.com/work/sandbo...le_display.html
"Jerry Camel" wrote:
> Thanks, but this doesn't seem to have any effect. I tried changing the
> style.display property to all kinds of values, but the checkbox never
> appears...
> Jerry
> "Sreejith Ram" <SreejithRam@.discussions.microsoft.com> wrote in message
> news:514C006A-51EE-42B4-938C-506D452587A4@.microsoft.com...
> 'Display:
> and
> Request.Forms["HiddenContrlName"]
> ...
> ,
> side
> to
> if
> and
> swiped.
> be
> I
> visible,
> post
> where
> viewstate?
>
>
I'll play with it. Thanks for your help. I was trying to use vbscript, but
I may have to switch to javascript...
Jerry
"Sreejith Ram" <SreejithRam@.discussions.microsoft.com> wrote in message
news:54BF5C69-C844-40FF-A427-409FEAED12EE@.microsoft.com...
> Obviously there is some thing not right other than the syntax.. :) .. Is
> there any javascript error when you call the function to display the
> checkbox?...
> if still no luck, you may want to create a simple HTML page with only
> following code in it...
> <INPUT TYPE=checkbox ID=chk1 style='display:hidden'>
> <INPUT TYPE=button ID=btn1 onClick="toggle()" value="Click to Toggle
> Display" >
> <script>
> function toggle(id)
> {
> el = document.getElementById("chk1");
> var display = el.style.display ? '' : 'none';
> el.style.display = display;
> }
> </script>
> Once this works, you can compare with the HTML your aspx generated and
that
> may help in finding the issue..
> This link got a working sample... with code...pls see if this helps..
> http://www.sam-i-am.com/work/sandbo...le_display.html
>
> "Jerry Camel" wrote:
>
document.getElementById("CheckBoxClientName").style.display='' ;
true;
state
message
style='display:none'
checkbox
client
attribute
But
automatically
can
swiped.
side
a
the
to?
postback,
Passing A Value To Server
The effect I want to accomplish is this:
The basic credit card fields are there and can be filled out. But if the
user swipes the card, I want to fill out the fields automatically and make
them read only. (So far I can do this.)
But I also want a checkbox to appear that indicates the card was swiped.
The user can clear the checkbox, re-enabling the fields so they can be
edited, but then I will no longer consider the data as being swiped. I want
the check box to disappear if they clear it.
Using server controls, if I create a checkbox, but make it not visible, then
it's not available at the client side to work with from client side code.
So I would need to send some flag back to the server to indicate a post back
and have the page re-rendered properly. But how do send info to the server
like that without having a visible control to attach the data to?
(Does this make any sense? Not sure if I'm explaining it well.)
Is there a way to send a value back to the server, in a postback, where the
data is not a property of a server control that's tracking viewstate? The
session object is only available on the server side right?
Any guidance here is appreciated. Thanks.
Jerryto send additional value to server , one commonly used method is
a HiddenControl (you will access it like Request.Forms["HiddenContrlName"]
from code behind)
or a TextBox Webcontrol with size 0 or attribute style='display:none' ..
But if the only purpose of post back is to display/check the checkbox ,
probabaly a better approach is to do the display/check in the client side
javascript ..
Instead of settign Visibility=False, you would just add an attribute to
make it hidden , but still available at client code
CheckBoxName.Attributes.Add("style='display:none'")
"Jerry Camel" wrote:
> Basic Web Form... A few text boxes and a checkbox - and a card reader...
> The effect I want to accomplish is this:
> The basic credit card fields are there and can be filled out. But if the
> user swipes the card, I want to fill out the fields automatically and make
> them read only. (So far I can do this.)
> But I also want a checkbox to appear that indicates the card was swiped.
> The user can clear the checkbox, re-enabling the fields so they can be
> edited, but then I will no longer consider the data as being swiped. I want
> the check box to disappear if they clear it.
> Using server controls, if I create a checkbox, but make it not visible, then
> it's not available at the client side to work with from client side code.
> So I would need to send some flag back to the server to indicate a post back
> and have the page re-rendered properly. But how do send info to the server
> like that without having a visible control to attach the data to?
> (Does this make any sense? Not sure if I'm explaining it well.)
> Is there a way to send a value back to the server, in a postback, where the
> data is not a property of a server control that's tracking viewstate? The
> session object is only available on the server side right?
> Any guidance here is appreciated. Thanks.
> Jerry
>
Okay... I can have the checkbox on the form and available with 'Display:
None'...
But I can't seem to find the proper syntax to change the display state and
make it visible on the client side...
Thanks.
"Sreejith Ram" <SreejithRam@.discussions.microsoft.com> wrote in message
news:431FA795-5920-4B2C-81E1-98224CD89497@.microsoft.com...
> to send additional value to server , one commonly used method is
> a HiddenControl (you will access it like Request.Forms["HiddenContrlName"]
> from code behind)
> or a TextBox Webcontrol with size 0 or attribute style='display:none' ..
> But if the only purpose of post back is to display/check the checkbox ,
> probabaly a better approach is to do the display/check in the client side
> javascript ..
> Instead of settign Visibility=False, you would just add an attribute to
> make it hidden , but still available at client code
> CheckBoxName.Attributes.Add("style='display:none'")
>
> "Jerry Camel" wrote:
> > Basic Web Form... A few text boxes and a checkbox - and a card
reader...
> > The effect I want to accomplish is this:
> > The basic credit card fields are there and can be filled out. But if
the
> > user swipes the card, I want to fill out the fields automatically and
make
> > them read only. (So far I can do this.)
> > But I also want a checkbox to appear that indicates the card was swiped.
> > The user can clear the checkbox, re-enabling the fields so they can be
> > edited, but then I will no longer consider the data as being swiped. I
want
> > the check box to disappear if they clear it.
> > Using server controls, if I create a checkbox, but make it not visible,
then
> > it's not available at the client side to work with from client side
code.
> > So I would need to send some flag back to the server to indicate a post
back
> > and have the page re-rendered properly. But how do send info to the
server
> > like that without having a visible control to attach the data to?
> > (Does this make any sense? Not sure if I'm explaining it well.)
> > Is there a way to send a value back to the server, in a postback, where
the
> > data is not a property of a server control that's tracking viewstate?
The
> > session object is only available on the server side right?
> > Any guidance here is appreciated. Thanks.
> > Jerry
Syntax to display ?
document.getElementById("CheckBoxClientName").style.display='' ;
document.getElementById("CheckBoxClientName").Checked = true;
this may help...
http://www.w3schools.com/htmldom/dom_obj_checkbox.asp
http://www.w3schools.com/htmldom/do...tyle.asp#layout
"Jerry Camel" wrote:
> Okay... I can have the checkbox on the form and available with 'Display:
> None'...
> But I can't seem to find the proper syntax to change the display state and
> make it visible on the client side...
> Thanks.
>
> "Sreejith Ram" <SreejithRam@.discussions.microsoft.com> wrote in message
> news:431FA795-5920-4B2C-81E1-98224CD89497@.microsoft.com...
> > to send additional value to server , one commonly used method is
> > a HiddenControl (you will access it like Request.Forms["HiddenContrlName"]
> > from code behind)
> > or a TextBox Webcontrol with size 0 or attribute style='display:none' ..
> > But if the only purpose of post back is to display/check the checkbox ,
> > probabaly a better approach is to do the display/check in the client side
> > javascript ..
> > Instead of settign Visibility=False, you would just add an attribute to
> > make it hidden , but still available at client code
> > CheckBoxName.Attributes.Add("style='display:none'")
> > "Jerry Camel" wrote:
> > > Basic Web Form... A few text boxes and a checkbox - and a card
> reader...
> > > The effect I want to accomplish is this:
> > > > The basic credit card fields are there and can be filled out. But if
> the
> > > user swipes the card, I want to fill out the fields automatically and
> make
> > > them read only. (So far I can do this.)
> > > > But I also want a checkbox to appear that indicates the card was swiped.
> > > The user can clear the checkbox, re-enabling the fields so they can be
> > > edited, but then I will no longer consider the data as being swiped. I
> want
> > > the check box to disappear if they clear it.
> > > > Using server controls, if I create a checkbox, but make it not visible,
> then
> > > it's not available at the client side to work with from client side
> code.
> > > So I would need to send some flag back to the server to indicate a post
> back
> > > and have the page re-rendered properly. But how do send info to the
> server
> > > like that without having a visible control to attach the data to?
> > > > (Does this make any sense? Not sure if I'm explaining it well.)
> > > > Is there a way to send a value back to the server, in a postback, where
> the
> > > data is not a property of a server control that's tracking viewstate?
> The
> > > session object is only available on the server side right?
> > > > Any guidance here is appreciated. Thanks.
> > > > Jerry
> > > >
Thanks, but this doesn't seem to have any effect. I tried changing the
style.display property to all kinds of values, but the checkbox never
appears...
Jerry
"Sreejith Ram" <SreejithRam@.discussions.microsoft.com> wrote in message
news:514C006A-51EE-42B4-938C-506D452587A4@.microsoft.com...
> Syntax to display ?
> document.getElementById("CheckBoxClientName").style.display='' ;
> document.getElementById("CheckBoxClientName").Checked = true;
> this may help...
> http://www.w3schools.com/htmldom/dom_obj_checkbox.asp
> http://www.w3schools.com/htmldom/do...tyle.asp#layout
>
> "Jerry Camel" wrote:
> > Okay... I can have the checkbox on the form and available with
'Display:
> > None'...
> > But I can't seem to find the proper syntax to change the display state
and
> > make it visible on the client side...
> > Thanks.
> > "Sreejith Ram" <SreejithRam@.discussions.microsoft.com> wrote in message
> > news:431FA795-5920-4B2C-81E1-98224CD89497@.microsoft.com...
> > > to send additional value to server , one commonly used method is
> > > > a HiddenControl (you will access it like
Request.Forms["HiddenContrlName"]
> > > from code behind)
> > > > or a TextBox Webcontrol with size 0 or attribute style='display:none'
...
> > > > But if the only purpose of post back is to display/check the checkbox
,
> > > probabaly a better approach is to do the display/check in the client
side
> > > javascript ..
> > > > Instead of settign Visibility=False, you would just add an attribute
to
> > > make it hidden , but still available at client code
> > > > CheckBoxName.Attributes.Add("style='display:none'")
> > > > > > "Jerry Camel" wrote:
> > > > > Basic Web Form... A few text boxes and a checkbox - and a card
> > reader...
> > > > The effect I want to accomplish is this:
> > > > > > The basic credit card fields are there and can be filled out. But
if
> > the
> > > > user swipes the card, I want to fill out the fields automatically
and
> > make
> > > > them read only. (So far I can do this.)
> > > > > > But I also want a checkbox to appear that indicates the card was
swiped.
> > > > The user can clear the checkbox, re-enabling the fields so they can
be
> > > > edited, but then I will no longer consider the data as being swiped.
I
> > want
> > > > the check box to disappear if they clear it.
> > > > > > Using server controls, if I create a checkbox, but make it not
visible,
> > then
> > > > it's not available at the client side to work with from client side
> > code.
> > > > So I would need to send some flag back to the server to indicate a
post
> > back
> > > > and have the page re-rendered properly. But how do send info to the
> > server
> > > > like that without having a visible control to attach the data to?
> > > > > > (Does this make any sense? Not sure if I'm explaining it well.)
> > > > > > Is there a way to send a value back to the server, in a postback,
where
> > the
> > > > data is not a property of a server control that's tracking
viewstate?
> > The
> > > > session object is only available on the server side right?
> > > > > > Any guidance here is appreciated. Thanks.
> > > > > > Jerry
> > > > > >
Obviously there is some thing not right other than the syntax.. :) .. Is
there any javascript error when you call the function to display the
checkbox?...
if still no luck, you may want to create a simple HTML page with only
following code in it...
<INPUT TYPE=checkbox ID=chk1 style='display:hidden'>
<INPUT TYPE=button ID=btn1 onClick="toggle()" value="Click to Toggle
Display"
<script>
function toggle(id)
{
el = document.getElementById("chk1");
var display = el.style.display ? '' : 'none';
el.style.display = display;
}
</script
Once this works, you can compare with the HTML your aspx generated and that
may help in finding the issue..
This link got a working sample... with code...pls see if this helps..
http://www.sam-i-am.com/work/sandbo...le_display.html
"Jerry Camel" wrote:
> Thanks, but this doesn't seem to have any effect. I tried changing the
> style.display property to all kinds of values, but the checkbox never
> appears...
> Jerry
> "Sreejith Ram" <SreejithRam@.discussions.microsoft.com> wrote in message
> news:514C006A-51EE-42B4-938C-506D452587A4@.microsoft.com...
> > Syntax to display ?
> > document.getElementById("CheckBoxClientName").style.display='' ;
> > document.getElementById("CheckBoxClientName").Checked = true;
> > this may help...
> > http://www.w3schools.com/htmldom/dom_obj_checkbox.asp
> > http://www.w3schools.com/htmldom/do...tyle.asp#layout
> > "Jerry Camel" wrote:
> > > Okay... I can have the checkbox on the form and available with
> 'Display:
> > > None'...
> > > > But I can't seem to find the proper syntax to change the display state
> and
> > > make it visible on the client side...
> > > > Thanks.
> > > > > "Sreejith Ram" <SreejithRam@.discussions.microsoft.com> wrote in message
> > > news:431FA795-5920-4B2C-81E1-98224CD89497@.microsoft.com...
> > > > to send additional value to server , one commonly used method is
> > > > > > a HiddenControl (you will access it like
> Request.Forms["HiddenContrlName"]
> > > > from code behind)
> > > > > > or a TextBox Webcontrol with size 0 or attribute style='display:none'
> ...
> > > > > > But if the only purpose of post back is to display/check the checkbox
> ,
> > > > probabaly a better approach is to do the display/check in the client
> side
> > > > javascript ..
> > > > > > Instead of settign Visibility=False, you would just add an attribute
> to
> > > > make it hidden , but still available at client code
> > > > > > CheckBoxName.Attributes.Add("style='display:none'")
> > > > > > > > > > "Jerry Camel" wrote:
> > > > > > > Basic Web Form... A few text boxes and a checkbox - and a card
> > > reader...
> > > > > The effect I want to accomplish is this:
> > > > > > > > The basic credit card fields are there and can be filled out. But
> if
> > > the
> > > > > user swipes the card, I want to fill out the fields automatically
> and
> > > make
> > > > > them read only. (So far I can do this.)
> > > > > > > > But I also want a checkbox to appear that indicates the card was
> swiped.
> > > > > The user can clear the checkbox, re-enabling the fields so they can
> be
> > > > > edited, but then I will no longer consider the data as being swiped.
> I
> > > want
> > > > > the check box to disappear if they clear it.
> > > > > > > > Using server controls, if I create a checkbox, but make it not
> visible,
> > > then
> > > > > it's not available at the client side to work with from client side
> > > code.
> > > > > So I would need to send some flag back to the server to indicate a
> post
> > > back
> > > > > and have the page re-rendered properly. But how do send info to the
> > > server
> > > > > like that without having a visible control to attach the data to?
> > > > > > > > (Does this make any sense? Not sure if I'm explaining it well.)
> > > > > > > > Is there a way to send a value back to the server, in a postback,
> where
> > > the
> > > > > data is not a property of a server control that's tracking
> viewstate?
> > > The
> > > > > session object is only available on the server side right?
> > > > > > > > Any guidance here is appreciated. Thanks.
> > > > > > > > Jerry
> > > > > > > > > > > > >
I'll play with it. Thanks for your help. I was trying to use vbscript, but
I may have to switch to javascript...
Jerry
"Sreejith Ram" <SreejithRam@.discussions.microsoft.com> wrote in message
news:54BF5C69-C844-40FF-A427-409FEAED12EE@.microsoft.com...
> Obviously there is some thing not right other than the syntax.. :) .. Is
> there any javascript error when you call the function to display the
> checkbox?...
> if still no luck, you may want to create a simple HTML page with only
> following code in it...
> <INPUT TYPE=checkbox ID=chk1 style='display:hidden'>
> <INPUT TYPE=button ID=btn1 onClick="toggle()" value="Click to Toggle
> Display" >
> <script>
> function toggle(id)
> {
> el = document.getElementById("chk1");
> var display = el.style.display ? '' : 'none';
> el.style.display = display;
> }
> </script>
> Once this works, you can compare with the HTML your aspx generated and
that
> may help in finding the issue..
> This link got a working sample... with code...pls see if this helps..
> http://www.sam-i-am.com/work/sandbo...le_display.html
>
> "Jerry Camel" wrote:
> > Thanks, but this doesn't seem to have any effect. I tried changing the
> > style.display property to all kinds of values, but the checkbox never
> > appears...
> > Jerry
> > "Sreejith Ram" <SreejithRam@.discussions.microsoft.com> wrote in message
> > news:514C006A-51EE-42B4-938C-506D452587A4@.microsoft.com...
> > > Syntax to display ?
> > document.getElementById("CheckBoxClientName").style.display='' ;
> > > document.getElementById("CheckBoxClientName").Checked =
true;
> > > > this may help...
> > > http://www.w3schools.com/htmldom/dom_obj_checkbox.asp
> > > http://www.w3schools.com/htmldom/do...tyle.asp#layout
> > > > > > "Jerry Camel" wrote:
> > > > > Okay... I can have the checkbox on the form and available with
> > 'Display:
> > > > None'...
> > > > > > But I can't seem to find the proper syntax to change the display
state
> > and
> > > > make it visible on the client side...
> > > > > > Thanks.
> > > > > > > > "Sreejith Ram" <SreejithRam@.discussions.microsoft.com> wrote in
message
> > > > news:431FA795-5920-4B2C-81E1-98224CD89497@.microsoft.com...
> > > > > to send additional value to server , one commonly used method is
> > > > > > > > a HiddenControl (you will access it like
> > Request.Forms["HiddenContrlName"]
> > > > > from code behind)
> > > > > > > > or a TextBox Webcontrol with size 0 or attribute
style='display:none'
> > ...
> > > > > > > > But if the only purpose of post back is to display/check the
checkbox
> > ,
> > > > > probabaly a better approach is to do the display/check in the
client
> > side
> > > > > javascript ..
> > > > > > > > Instead of settign Visibility=False, you would just add an
attribute
> > to
> > > > > make it hidden , but still available at client code
> > > > > > > > CheckBoxName.Attributes.Add("style='display:none'")
> > > > > > > > > > > > > > "Jerry Camel" wrote:
> > > > > > > > > Basic Web Form... A few text boxes and a checkbox - and a card
> > > > reader...
> > > > > > The effect I want to accomplish is this:
> > > > > > > > > > The basic credit card fields are there and can be filled out.
But
> > if
> > > > the
> > > > > > user swipes the card, I want to fill out the fields
automatically
> > and
> > > > make
> > > > > > them read only. (So far I can do this.)
> > > > > > > > > > But I also want a checkbox to appear that indicates the card was
> > swiped.
> > > > > > The user can clear the checkbox, re-enabling the fields so they
can
> > be
> > > > > > edited, but then I will no longer consider the data as being
swiped.
> > I
> > > > want
> > > > > > the check box to disappear if they clear it.
> > > > > > > > > > Using server controls, if I create a checkbox, but make it not
> > visible,
> > > > then
> > > > > > it's not available at the client side to work with from client
side
> > > > code.
> > > > > > So I would need to send some flag back to the server to indicate
a
> > post
> > > > back
> > > > > > and have the page re-rendered properly. But how do send info to
the
> > > > server
> > > > > > like that without having a visible control to attach the data
to?
> > > > > > > > > > (Does this make any sense? Not sure if I'm explaining it well.)
> > > > > > > > > > Is there a way to send a value back to the server, in a
postback,
> > where
> > > > the
> > > > > > data is not a property of a server control that's tracking
> > viewstate?
> > > > The
> > > > > > session object is only available on the server side right?
> > > > > > > > > > Any guidance here is appreciated. Thanks.
> > > > > > > > > > Jerry
> > > > > > > > > > > > > > > > > >
passing a variable to new page
I am new to asp.net, please help.
I have link and this works fine
Add/Edit
In classic asp I would use
<% Request.form("tbName ") %>or
<% Request("tbName") %>Sometimes I would assign this value to a variable and use it anywhere on the page.
How do I do this or is there a better way to do it in .net.
TIA MichaelIn the adim_sCodeEdit.aspx file, you just do the same:
(In the code behind file)
Dim tbName as string = request.params("tbName")...
And do the test, make sure you capture the right result:
response.write(tbName)
Thanks for the quick reply le9569
My companies isp does not support code behind.
This is how I have it now and it works. I was not sure where to put the
response.write(tbName)to make it work, everyplace I tried gave me errors.
Thanks again
<%@. Page Language="vb" Debug="true" %>
<script runat="server">
Sub Page_Load(Source as Object, E as EventArgs)
Dim tbName as string = request.params("tbName")
lbltbName.text = tbName
End Sub</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:Label id="lbltbName" runat="server"></asp:Label>
</form>
</body>
</html>
Passing a Variable?
Having an issue when passin a variable form one page to another.....can anyone please make this headache go away by point out the eror of my ways..Have a feeling its sql statement.......(as always!!!!)
Any help would be most appreciated,,
Cheers
Tony
CODE
Dim lota as string
Public strSearch as string
Public strSearcha as string
Dim counta as string
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)
lota = Request.QueryString("lota")
If Not Page.IsPostBack Then
'if Not IsPostBack Then
Dim DBConn as OleDbConnection
Dim DBCommand As OleDbDataAdapter
Dim DSPageData as New DataSet
DBConn = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" _
& "DATA SOURCE=" _
& Server.MapPath("/fpdb/" _
& "auction.mdb;"))
DBCommand = New OleDbDataAdapter _
("Select Distinct LotDescription " _
& "From Table1 " _
& "Where Date = & lota & "
& "Order By LotDescription", DBConn)
DBCommand.Fill(DSPageData, _
"LotDescription")
ddlZipCode.DataSource = _
DSPageData.Tables("LotDescription").DefaultView
ddlZipCode.DataBind()
dbconn.close
end if
end sub
Error Message
Server Error in '/' Application.
------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30311: Value of type 'String' cannot be converted to 'System.Data.OleDb.OleDbCommand'.
Source Error:
Line 30: & "auction.mdb;"))
Line 31: DBCommand = New OleDbDataAdapter _
Line 32: ("Select Distinct LotDescription " _
Line 33: & "From Table1 " _
Line 34: & "Where Date = & lota & "you need to create an additional object of type OleDbCommand.
Dim DBcommand As New OleDb.OleDbCommand
DBcommand.CommandText = "select * from table1"
DBAdapter = new OleDbDataAdapter(DBcommand)
Passing an array as a session variable
I have 2 asp.net forms. In the first form I create a one dimensional array and copy that array into a session object. In the second form I want to read the elements of that array. Everything I've tried results in either a casting error, a late binding error or nothing at all. The following code shows what Iwant to do.
Form one: Dim aArray(2) as stringaArray(0) = "zero"aArray(1) = "one"Session("PassArray") = aArrayForm two: Dim aTest(2) as stringaTest(0) = CType(Session("PassArray(0)"), String)aTest(1) = CType(Session("PassArray(1)"), String)When I run form two in the editor, I can Watch Session("PassArray") and see:Session("PassArray") {System.Array} object-- (0) "zero" string-- (1) "one" stringSo I know it's there and available, but how do I read the extents.Could really use a simple code example to explain what I'm doing wrong.
Hi,
Use this on the second form:
Dim aTest() As String = CType(Session("PassArray"), String())
That did it. Thank you.