Thursday, March 29, 2012
Pass information from XML file to ASPX page
I have an XML file, which contains let's say a <A> tag with a "AProp"
property. I want to manipulate this XML file so that the value of the
AProp property can be passed to the code-behind class (let's say
code.aspx.cs) of another ASPX page. How can I accomplish that?
Thanks in advance for help,
uservoidHi evangelous,
Maybe this can help you:
http://www.planet-source-code.com/v...gWId=10
Guillermo G.
----
--
Guillermo Gonzlez Arroyave :: MCP ASP.Net C# :: DCE4
<evangelous@.gmail.com> wrote in message news:1122017876.519551.161420@.g49g20
00cwa.googlegroups.com...
Hello,
I have an XML file, which contains let's say a <A> tag with a "AProp"
property. I want to manipulate this XML file so that the value of the
AProp property can be passed to the code-behind class (let's say
code.aspx.cs) of another ASPX page. How can I accomplish that?
Thanks in advance for help,
uservoid
Pass information from XML file to ASPX page
I have an XML file, which contains let's say a <A> tag with a "AProp"
property. I want to manipulate this XML file so that the value of the
AProp property can be passed to the code-behind class (let's say
code.aspx.cs) of another ASPX page. How can I accomplish that?
Thanks in advance for help,
uservoidHi evangelous,
Maybe this can help you:
http://www.planet-source-code.com/v...=3753&lngWId=10
Guillermo G.
------------------------
Guillermo Gonzlez Arroyave :: MCP ASP.Net C# :: DCE4
<evangelous@.gmail.com> wrote in message news:1122017876.519551.161420@.g49g2000cwa.googlegr oups.com...
Hello,
I have an XML file, which contains let's say a <A> tag with a "AProp"
property. I want to manipulate this XML file so that the value of the
AProp property can be passed to the code-behind class (let's say
code.aspx.cs) of another ASPX page. How can I accomplish that?
Thanks in advance for help,
uservoid
Pass Listitem between Listboxes
that the user has. The "Value" of the items is NOT the same as the "Text".
The user can select an item (or items) from one listbox and move it to the
other listbox. The code for it is:
Dim x, deleted As Integer
For x = 0 To lboxFrom.Items.Count - 1
If lboxFrom.Items.Item(x - deleted).Selected Then
lboxTo.Items.Add(lboxFrom.Items.Item(x - deleted))
lboxFrom.Items.Remove(lboxFrom.Items.Item(x - deleted))
deleted += 1
End If
Next
I have also tried:
Dim x, deleted As Integer
For x = 0 To lboxFrom.Items.Count - 1
If lboxFrom.Items.Item(x - deleted).Selected Then
Dim newItem As New ListItem()
newItem.Text = lboxFrom.Items.Item(x - deleted).Text
newItem.Value = lboxFrom.Items.Item(x - deleted).Value
lboxTo.Items.Add(newItem)
lboxFrom.Items.Remove(lboxFrom.Items.Item(x - deleted))
deleted += 1
End If
Next
The item that passes to the second listbox should have value of the first
listbox item and also the text of the first listbox item. My problem is tha
t
the value and the text of the item placed in the second listbox end up the
same and equal the text of the item in the first listbox. Why is it doing
this and what can I do to get the value for the item from the first listbox
to pass as the value for the item in the second listbox?
Thanks.Hi,
Your code seems fine. Try debugging it, specifically the second way and
place a breakpoint on
> newItem.Text = lboxFrom.Items.Item(x - deleted).Text
then step into until you see what are the runtime values of
lboxFrom.Items.Item(x - deleted).Text and lboxFrom.Items.Item(x -
deleted).Value
I tested (in C# though) with the following handler of the button click:
protected void b1_Click(object s, EventArgs e)
{
System.Web.UI.WebControls.ListItem li;
int i = 0;
while(i < lboxFrom.Items.Count)
{
if(lboxFrom.Items[i].Selected)
{
li = new System.Web.UI.WebControls.ListItem(
lboxFrom.Items[i].Text, lboxFrom.Items[i].Value);
lboxTo.Items.Add(li);
lboxFrom.Items.RemoveAt(i);
continue;
}
i++;
}
}
and the new items in the "To" ListBox have the text *and* the value of the
ones removed from the "From" ListBox
Hope this helps
Martin
"ScoutLee" <ScoutLee@.discussions.microsoft.com> wrote in message
news:D6DA1B2E-1030-4618-94AE-E43069303EDB@.microsoft.com...
> I have two listboxes. The first listbox is prepopulated with the
selections
> that the user has. The "Value" of the items is NOT the same as the
"Text".
> The user can select an item (or items) from one listbox and move it to the
> other listbox. The code for it is:
> Dim x, deleted As Integer
> For x = 0 To lboxFrom.Items.Count - 1
> If lboxFrom.Items.Item(x - deleted).Selected Then
> lboxTo.Items.Add(lboxFrom.Items.Item(x - deleted))
> lboxFrom.Items.Remove(lboxFrom.Items.Item(x - deleted))
> deleted += 1
> End If
> Next
> I have also tried:
> Dim x, deleted As Integer
> For x = 0 To lboxFrom.Items.Count - 1
> If lboxFrom.Items.Item(x - deleted).Selected Then
> Dim newItem As New ListItem()
> newItem.Text = lboxFrom.Items.Item(x - deleted).Text
> newItem.Value = lboxFrom.Items.Item(x - deleted).Value
> lboxTo.Items.Add(newItem)
> lboxFrom.Items.Remove(lboxFrom.Items.Item(x - deleted))
> deleted += 1
> End If
> Next
> The item that passes to the second listbox should have value of the first
> listbox item and also the text of the first listbox item. My problem is
that
> the value and the text of the item placed in the second listbox end up the
> same and equal the text of the item in the first listbox. Why is it doing
> this and what can I do to get the value for the item from the first
listbox
> to pass as the value for the item in the second listbox?
> Thanks.
>
Pass NULL To Stored Procedure
Server 2005 DB table using a stored procedure? I tried the following
but it inserts an empty string & not a NULL value:
ALTER PROCEDURE dbo.Purchase
@dotnet.itags.org.UserID int,
@dotnet.itags.org.Total decimal,
@dotnet.itags.org.Address varchar(250) = NULL,
@dotnet.itags.org.Country varchar(50) = NULL
AS
INSERT INTO Order (UserID, Address, Country, Total) VALUES (@dotnet.itags.org.UserID,
@dotnet.itags.org.Address, @dotnet.itags.org.Country, @dotnet.itags.org.Total)
I am invoking the above SP with this code in a class file:
Public Class Cart
Public Sub PlaceOrder(ByVal UserID As Integer, ByVal Total As
Double, ByVal Address As String, ByVal Country As String)
Dim sqlConn As SqlConnection
Dim sqlCmd As SqlCommand
sqlConn = New SqlConnection("....")
sqlCmd = New SqlCommand("Purchase", sqlConn)
sqlCmd.CommandType = CommandType.StoredProcedure
With sqlCmd
.Parameters.Add("@dotnet.itags.org.UserID", SqlDbType.Int).Value = UserID
.Parameters.Add("@dotnet.itags.org.Total", SqlDbType.Decimal).Value = Total
.Parameters.Add("@dotnet.itags.org.Address", SqlDbType.VarChar, 250).Value =
Address
.Parameters.Add("@dotnet.itags.org.Country", SqlDbType.VarChar, 50).Value =
Country
End With
sqlConn.Open()
sqlCmd.ExecuteNonQuery()
sqlConn.Close()
End Sub
End Class
Using vbc, I compiled the above into a DLL named Cart.dll.
This is the ASPX code (if no values are supplied for the variables
'strAddress' & 'strCountry', those records should be inserted as NULLs
in the DB table):
Sub Submit_Click(....)
Dim boCart As Cart
boCart = New Cart
If (strAddress = "") Then
strAddress = DBNull.Value.ToString
End If
If (strCountry = "") Then
strCountry = DBNull.Value.ToString
End If
boCart.PlaceOrder(iUserID, dblTotal, strAddress, strCountry)
End Sub<rn5a@.rediffmail.com> wrote in message
news:1160169983.937789.306620@.k70g2000cwa.googlegroups.com...
> How do I pass a NULL value to a field while inserting records in a SQL
> Server 2005 DB table using a stored procedure? I tried the following
> but it inserts an empty string & not a NULL value:
.Parameters.Add("@.Address", SqlDbType.VarChar, 250).Value = DbNull.Value
Plus what Mark mention
I think you can set your instance to Nothing
like:
address = nothing;
but if you your object is value type, you have to use the way Mark Mentioned
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
"rn5a@.rediffmail.com" wrote:
> How do I pass a NULL value to a field while inserting records in a SQL
> Server 2005 DB table using a stored procedure? I tried the following
> but it inserts an empty string & not a NULL value:
> ALTER PROCEDURE dbo.Purchase
> @.UserID int,
> @.Total decimal,
> @.Address varchar(250) = NULL,
> @.Country varchar(50) = NULL
> AS
> INSERT INTO Order (UserID, Address, Country, Total) VALUES (@.UserID,
> @.Address, @.Country, @.Total)
> I am invoking the above SP with this code in a class file:
> Public Class Cart
> Public Sub PlaceOrder(ByVal UserID As Integer, ByVal Total As
> Double, ByVal Address As String, ByVal Country As String)
> Dim sqlConn As SqlConnection
> Dim sqlCmd As SqlCommand
> sqlConn = New SqlConnection("....")
> sqlCmd = New SqlCommand("Purchase", sqlConn)
> sqlCmd.CommandType = CommandType.StoredProcedure
> With sqlCmd
> .Parameters.Add("@.UserID", SqlDbType.Int).Value = UserID
> .Parameters.Add("@.Total", SqlDbType.Decimal).Value = Total
> .Parameters.Add("@.Address", SqlDbType.VarChar, 250).Value =
> Address
> .Parameters.Add("@.Country", SqlDbType.VarChar, 50).Value =
> Country
> End With
> sqlConn.Open()
> sqlCmd.ExecuteNonQuery()
> sqlConn.Close()
> End Sub
> End Class
> Using vbc, I compiled the above into a DLL named Cart.dll.
> This is the ASPX code (if no values are supplied for the variables
> 'strAddress' & 'strCountry', those records should be inserted as NULLs
> in the DB table):
> Sub Submit_Click(....)
> Dim boCart As Cart
> boCart = New Cart
> If (strAddress = "") Then
> strAddress = DBNull.Value.ToString
> End If
> If (strCountry = "") Then
> strCountry = DBNull.Value.ToString
> End If
> boCart.PlaceOrder(iUserID, dblTotal, strAddress, strCountry)
> End Sub
>
Pass NULL To Stored Procedure
Server 2005 DB table using a stored procedure? I tried the following
but it inserts an empty string & not a NULL value:
ALTER PROCEDURE dbo.Purchase
@dotnet.itags.org.UserID int,
@dotnet.itags.org.Total decimal,
@dotnet.itags.org.Address varchar(250) = NULL,
@dotnet.itags.org.Country varchar(50) = NULL
AS
INSERT INTO Order (UserID, Address, Country, Total) VALUES (@dotnet.itags.org.UserID,
@dotnet.itags.org.Address, @dotnet.itags.org.Country, @dotnet.itags.org.Total)
I am invoking the above SP with this code in a class file:
Public Class Cart
Public Sub PlaceOrder(ByVal UserID As Integer, ByVal Total As
Double, ByVal Address As String, ByVal Country As String)
Dim sqlConn As SqlConnection
Dim sqlCmd As SqlCommand
sqlConn = New SqlConnection("....")
sqlCmd = New SqlCommand("Purchase", sqlConn)
sqlCmd.CommandType = CommandType.StoredProcedure
With sqlCmd
.Parameters.Add("@dotnet.itags.org.UserID", SqlDbType.Int).Value = UserID
.Parameters.Add("@dotnet.itags.org.Total", SqlDbType.Decimal).Value = Total
.Parameters.Add("@dotnet.itags.org.Address", SqlDbType.VarChar, 250).Value =
Address
.Parameters.Add("@dotnet.itags.org.Country", SqlDbType.VarChar, 50).Value =
Country
End With
sqlConn.Open()
sqlCmd.ExecuteNonQuery()
sqlConn.Close()
End Sub
End Class
Using vbc, I compiled the above into a DLL named Cart.dll.
This is the ASPX code (if no values are supplied for the variables
'strAddress' & 'strCountry', those records should be inserted as NULLs
in the DB table):
Sub Submit_Click(....)
Dim boCart As Cart
boCart = New Cart
If (strAddress = "") Then
strAddress = DBNull.Value.ToString
End If
If (strCountry = "") Then
strCountry = DBNull.Value.ToString
End If
boCart.PlaceOrder(iUserID, dblTotal, strAddress, strCountry)
End Sub<rn5a@.rediffmail.comwrote in message
news:1160169983.937789.306620@.k70g2000cwa.googlegr oups.com...
Quote:
Originally Posted by
How do I pass a NULL value to a field while inserting records in a SQL
Server 2005 DB table using a stored procedure? I tried the following
but it inserts an empty string & not a NULL value:
..Parameters.Add("@.Address", SqlDbType.VarChar, 250).Value = DbNull.Value
Plus what Mark mention
I think you can set your instance to Nothing
like:
address = nothing;
but if you your object is value type, you have to use the way Mark Mentioned
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
"rn5a@.rediffmail.com" wrote:
Quote:
Originally Posted by
How do I pass a NULL value to a field while inserting records in a SQL
Server 2005 DB table using a stored procedure? I tried the following
but it inserts an empty string & not a NULL value:
>
ALTER PROCEDURE dbo.Purchase
@.UserID int,
@.Total decimal,
@.Address varchar(250) = NULL,
@.Country varchar(50) = NULL
AS
>
INSERT INTO Order (UserID, Address, Country, Total) VALUES (@.UserID,
@.Address, @.Country, @.Total)
>
I am invoking the above SP with this code in a class file:
>
Public Class Cart
Public Sub PlaceOrder(ByVal UserID As Integer, ByVal Total As
Double, ByVal Address As String, ByVal Country As String)
Dim sqlConn As SqlConnection
Dim sqlCmd As SqlCommand
>
sqlConn = New SqlConnection("....")
sqlCmd = New SqlCommand("Purchase", sqlConn)
sqlCmd.CommandType = CommandType.StoredProcedure
>
With sqlCmd
.Parameters.Add("@.UserID", SqlDbType.Int).Value = UserID
.Parameters.Add("@.Total", SqlDbType.Decimal).Value = Total
.Parameters.Add("@.Address", SqlDbType.VarChar, 250).Value =
Address
.Parameters.Add("@.Country", SqlDbType.VarChar, 50).Value =
Country
End With
>
sqlConn.Open()
sqlCmd.ExecuteNonQuery()
sqlConn.Close()
End Sub
End Class
>
Using vbc, I compiled the above into a DLL named Cart.dll.
>
This is the ASPX code (if no values are supplied for the variables
'strAddress' & 'strCountry', those records should be inserted as NULLs
in the DB table):
>
Sub Submit_Click(....)
Dim boCart As Cart
boCart = New Cart
>
If (strAddress = "") Then
strAddress = DBNull.Value.ToString
End If
>
If (strCountry = "") Then
strCountry = DBNull.Value.ToString
End If
>
boCart.PlaceOrder(iUserID, dblTotal, strAddress, strCountry)
End Sub
>
>
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 to DataList Datasource!
I am trying pass a value to the DataSource method in a DataList like below.
DataSource = <%# GetData(DataBinder.Eval(Container.DataItem, "ID"))%>"
I get an error with this code, and am wondering if someone can show me the
correct syntax.
I have asked this question before, but unfortunately i don't remember the
correct syntax.
I know i can acheive the desired result using code behind 'ItemDataBound',
but am prefering to do it in the aspx page itself..
All help appreciated.
<asp:DataList ID="dlTest"
DataKeyField = "ID"
DataSource = <%# GetData(DataBinder.Eval(Container.DataItem,
"ID"))%>">
<ItemTemplate><%# DataBinder.Eval(Container.DataItem,
"Name")%></ItemTemplate>
</asp:DataList>
Cheers,
AdamDataSource should be set to an on object containing data items. What is it
in your case?
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"AJ" <AJ@.discussions.microsoft.comwrote in message
news:3C74BA0B-76DB-42B0-A32B-E2EF219A44BC@.microsoft.com...
Quote:
Originally Posted by
Hi all,
>
I am trying pass a value to the DataSource method in a DataList like
below.
DataSource = <%# GetData(DataBinder.Eval(Container.DataItem, "ID"))%>"
>
I get an error with this code, and am wondering if someone can show me the
correct syntax.
>
I have asked this question before, but unfortunately i don't remember the
correct syntax.
>
I know i can acheive the desired result using code behind 'ItemDataBound',
but am prefering to do it in the aspx page itself..
>
All help appreciated.
>
<asp:DataList ID="dlTest"
DataKeyField = "ID"
DataSource = <%# GetData(DataBinder.Eval(Container.DataItem,
"ID"))%>">
<ItemTemplate><%# DataBinder.Eval(Container.DataItem,
"Name")%></ItemTemplate>
</asp:DataList>
>
Cheers,
Adam
Pass parameter to Popup window
On Webform1, I have one text box1 and one button.
on Webform2, I have one text box .
I need transfer the value of textbox 1 in webform1 to textbox2 in
webform2. and popup webform2 when user click on the button on webform1.
I have code in webform1:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Button1.Attributes.Add("onclick", "window.open('WebForm2.aspx?a=" +
TextBox1.Text.ToString + "',null,'height=250, width=250,status= no,
resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');")
End Sub
and following code in webform2:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
TextBox1.Text = Request("a").ToString
End Sub
I could not get the result unless I click on the button1 twice. i know
what happen in here but have no solution. I will be appreciated if you
could help here.
Thanks in advanced,
DiHi ,
You can achieve this by injecting a javascript in the Button1 click
event on the server side . Write an function to inject an javascript in the
webform1 button1 click.
Don't do anything with Attributes of button1 as it won't achieve result u
requires as the 1st page the textbox1 value would be blank.
private void openWindowInjectScript(){
string myScript;
myScript = "<scr" + "ipt>window.open('WebForm2.aspx?a=" + txtIdfield.Value
+ "',null,'height=250, width=250,status= no,resizable= no, scrollbars=no,
toolbar=no,location=no,menubar=no'); </scr" + "ipt>";
this.Page.RegisterStartupScript("JavaScript",myScript);
}
In the webform1.aspx button1_Click event
private void Button1_Click(object sender, System.EventArgs e)
{
openWindowInjectScript();
}
Basically openwindowInjectScript register a script at pageload and which
will make to open an window with current values.
This is the way out for it and it should work
Regards
IntelYogi
"dyw55a@.yahoo.com" wrote:
> I have 2 webform in vb.NET application.
> On Webform1, I have one text box1 and one button.
> on Webform2, I have one text box .
> I need transfer the value of textbox 1 in webform1 to textbox2 in
> webform2. and popup webform2 when user click on the button on webform1.
> I have code in webform1:
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> Button1.Attributes.Add("onclick", "window.open('WebForm2.aspx?a=" +
> TextBox1.Text.ToString + "',null,'height=250, width=250,status= no,
> resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');")
> End Sub
> and following code in webform2:
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> TextBox1.Text = Request("a").ToString
> End Sub
>
> I could not get the result unless I click on the button1 twice. i know
> what happen in here but have no solution. I will be appreciated if you
> could help here.
> Thanks in advanced,
> Di
>
Thank you for your reply. But actually I tried and this did not work
for some reason, any idea?
Try this onClick event of your button
Response.Write("<SCRIPT>");
Response.Write("window.open('page,aspx?value=" + myval +
" ',null,'height=200,width=900,status=yes,
toolbar=no,menubar=no,location=no')
;
");
Response.Write("</SCRIPT>");
I think this will do the trick, tell me if not
dyw55a@.yahoo.com wrote in message news:<1117647067.875660.133640@.g43g2000cwa.googlegroups.c
om>...
> Thank you for your reply. But actually I tried and this did not work
> for some reason, any idea?
Pass parameter to Popup window
On Webform1, I have one text box1 and one button.
on Webform2, I have one text box .
I need transfer the value of textbox 1 in webform1 to textbox2 in
webform2. and popup webform2 when user click on the button on webform1.
I have code in webform1:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Button1.Attributes.Add("onclick", "window.open('WebForm2.aspx?a=" +
TextBox1.Text.ToString + "',null,'height=250, width=250,status= no,
resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');")
End Sub
and following code in webform2:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
TextBox1.Text = Request("a").ToString
End Sub
I could not get the result unless I click on the button1 twice. i know
what happen in here but have no solution. I will be appreciated if you
could help here.
Thanks in advanced,
DiHi ,
You can achieve this by injecting a javascript in the Button1 click
event on the server side . Write an function to inject an javascript in the
webform1 button1 click.
Don't do anything with Attributes of button1 as it won't achieve result u
requires as the 1st page the textbox1 value would be blank.
private void openWindowInjectScript(){
string myScript;
myScript = "<scr" + "ipt>window.open('WebForm2.aspx?a=" + txtIdfield.Value
+ "',null,'height=250, width=250,status= no,resizable= no, scrollbars=no,
toolbar=no,location=no,menubar=no'); </scr" + "ipt>";
this.Page.RegisterStartupScript("JavaScript",myScript);
}
In the webform1.aspx button1_Click event
private void Button1_Click(object sender, System.EventArgs e)
{
openWindowInjectScript();
}
Basically openwindowInjectScript register a script at pageload and which
will make to open an window with current values.
This is the way out for it and it should work
Regards
IntelYogi
"dyw55a@.yahoo.com" wrote:
> I have 2 webform in vb.NET application.
> On Webform1, I have one text box1 and one button.
> on Webform2, I have one text box .
> I need transfer the value of textbox 1 in webform1 to textbox2 in
> webform2. and popup webform2 when user click on the button on webform1.
> I have code in webform1:
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> Button1.Attributes.Add("onclick", "window.open('WebForm2.aspx?a=" +
> TextBox1.Text.ToString + "',null,'height=250, width=250,status= no,
> resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');")
> End Sub
> and following code in webform2:
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> TextBox1.Text = Request("a").ToString
> End Sub
>
> I could not get the result unless I click on the button1 twice. i know
> what happen in here but have no solution. I will be appreciated if you
> could help here.
> Thanks in advanced,
> Di
>
Thank you for your reply. But actually I tried and this did not work
for some reason, any idea?
Try this onClick event of your button
Response.Write("<SCRIPT>");
Response.Write("window.open('page,aspx?value=" + myval +
"',null,'height=200,width=900,status=yes,toolbar=no ,menubar=no,location=no');
");
Response.Write("</SCRIPT>");
I think this will do the trick, tell me if not
dyw55a@.yahoo.com wrote in message news:<1117647067.875660.133640@.g43g2000cwa.googlegroups. com>...
> Thank you for your reply. But actually I tried and this did not work
> for some reason, any idea?
i'd tried both suggest solutions from Yogi, but it seems not work for me...is any solution yet?
the prob is...webform2's page_load will be run 1st b4 the button_click event run...so any wisdom can help up?
From http://www.developmentnow.com/g/8_2...opup-window.htm
Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Pass Session Variable Value to Crystal Report?
whenever they want to run a report. On this page, I have added an
additional text box for the user to enter in comments about the report
they are running.
I would like to be able to have the comments that the user has entered
to appear on the report that is generated. I thought that I might be
able to pass this text to the report by using a session variable but I
have had no luck. It doesn't matter if I use a session variable to
accomplish this.
Can someone tell me how I can the user's comments from the web form
appear on the report?
Thanks!I figured out a way to accomplish this. I created a session variable
named UComments and stored the text that the user typed in it. On my
Crystal Report I created a blank formula field named UserComments I
next added the following code to my web form:
Dim oRpt As CrystalDecisions.CrystalReports.Engine.ReportDocum ent
= New CrystalDecisions.CrystalReports.Engine.ReportDocum ent()
'*** TELLING THE PROGRAM WHER THE REPORT IS LOCATED
'*** AND WHAT THE REPORT'S NAME IS. ***
oRpt.Load(Session("ReportLocation") & "Grant.rpt")
'*** CODE TO WRITE USER'S COMMENTS TO THE REPORT. ***
oRpt.DataDefinition.FormulaFields.Item("UserComments").Text = "'"
+ Trim(Session("UComments")) + "'"
CrystalReportViewer1.ReportSource = oRpt
crjunk@.earthlink.net (crjunk) wrote in message news:<e45e90aa.0308061021.788041e6@.posting.google.com>...
> I've got an aspx page that allows the user to select different options
> whenever they want to run a report. On this page, I have added an
> additional text box for the user to enter in comments about the report
> they are running.
> I would like to be able to have the comments that the user has entered
> to appear on the report that is generated. I thought that I might be
> able to pass this text to the report by using a session variable but I
> have had no luck. It doesn't matter if I use a session variable to
> accomplish this.
> Can someone tell me how I can the user's comments from the web form
> appear on the report?
> Thanks!
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 the web value from asp.net to asp by url
hi all,
i have two web files, one is *.aspx and the other is *.asp
i need pass textbox.text value from *.aspx to *.asp
so i can process the value(ex:string ) in *.asp
i pass the value like this
<a href="http://links.10026.com/?link=iflowall.asp?case_no=<%=(case.Text)%>&bank_no=<%=(bank_no.Text)%>">connect</a></p>
and receive from *.aspx like this
<td><%= Request.QueryString("case_no") %>æ–¼<%= Request.QueryString("bank_name") %></td>
in *.asp, it can't decode the string "bank_name" so the value is null why?
if the string is about number(ex:1234) it`s ok, but wrong when the string is chinses word(ex:䏿–‡)
Yes you got the Query string wrong. As in your .aspx constructed url, the query string parameter is bank_no not bank_name
Pass the values to the sub..
i want to pass these two value to another sub(passvalue ())..
Sub page_load(source as object, E as eventArgs)
strvalue1="value1"
strvalue2="value2"
passvalue()
end sub
sub passvalue()
xxxxxxxxx
end sub
Sub page_load(source as object, E as eventArgs)
strvalue1="value1"
strvalue2="value2"passvalue(strvalue1, strvalue2)
end sub
sub passvalue(byval arg1 as string, byval arg2 as string, etc...)
xxxxxxxxx
end sub
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
Pass Value from HTML to Code Behind
receiving variable in Code Behind?
My program passes a value to a function in HTML '**** This works fine ****'
'****** CODE BEHIND ******'
Private Sub MyDataGrid(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles MyDataGrid.ItemDataBound
Dim x As Integer
For x = 0 To 1
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
e.Item.Cells(x).Attributes.Add("onclick", "sample('" & e.Item.Cells(x).Text & "')")
End If
Next
End Sub
'MY PROBLEM IS IN HERE. I want to pass a variable back to the Code Behind
'******* HTML *******'
<script language="javascript"
function sample(j)
'PROCESS j AND PASS IT BACK TO A VARIABLE IN CODE BEHIND
{
</script
i tried to make a public variable in code behind but it wont get the value passed
i think it is because of ITEMDATABOUND.
PLEASE HELP ME . . . Please show me how to make this work. . .Not sure exactly what you are trying to do but one easy way to pass values to the server is using Hidden Fields, so the idea is before posting back to the server you set the value using classic javascript and then in the server you will be able to read it either using the Request.Form collection or if you add this as a runat=server control using the Control.Value property.
So in your .aspx page, add this:
<INPUT Type="Hidden" ID="Hidden1" Name="Hidden1"
and in your javascript sample function, you can manipulate this field throught the "document" object. And then in your codebehind, you can simply retrieve the value:
string theValue=Request.Form["Hidden1"];
Pass Value from Code Behind to TextBox
Hi, I have a very basic question (I am a beginner)
How do I pass a value from the Code Behind to, say, a text box?
I've got this on my aspx page:
<asp:TextBoxID="TextBox1"runat="server"Text=strTestOnTextChanged="TextBox1_TextChanged"></asp:TextBox>All I want to do is pass the value of strTest from the Code Behind to display in the Text Box. This is what I have in the code behind:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
publicpartialclass_Default : System.Web.UI.Page{
protectedvoid Page_Load(object sender,EventArgs e){
String strText;strText ="Hello";}
}
How can I get this to work?
It's very simple just try this
protectedvoid Page_Load(object sender,EventArgs e){
String strText;strText ="Hello";
TextBox1.Text =strText;}
You are right...it is very simple;
Thanks for the help...and Iapologize for the very basic question;
don't forget to mark as answerd the post if it is.
Greets
Whenever you write something in PageLoad event, it should be executed with every postback event... So use IsPostBack event of page to identify page was post back or not ...
Pass value from javascript to vb.net to database without postback...Possible?
I have a complicated question that I'm hoping someone can help me out
with. I have a webpage that contains a plug-in. This plug-in can
communicate/pass data with the webpage that contains it via javascript.
What I need to be able to do is take that data passed via javascript
and, using vb.net as the code behind language, send it to a database
without posting it because when I post, the plugin is reloaded and
starts at the beginning. Specifcally, the plug-in is a type of
educational program, when the user completes a certain objective in the
program, I need to store that info in the database but not have the
program start back at the beginning.
What happens currently is upon completing the objective in the plugin,
a javascript function is called in the containing webpage. That
javascript function changes the data in a hidden field runat the
server. I artificially create a postback using the
document.forms.submit() function, then in the page_load function in the
codebehind page I check the value of the hidden field and store it to
the database. This works fine. The problem is that when the page
reloads, my plug-in is reloaded and instead of the user being at say
level 6, they are back at the initial level 1. Ideally, I would like to
send the information to the database without having to reload the page
and was wondering if this was possible.
Thanks in advance and I'll be happy to clarify any questions.
AndyYou would need to do something like use XMLHTTP to issue a call to a page to
do the work. However, I think that ties you to IE 5.5 and above. This may
or may not be a problem for you.
"Andy" <acs974@.hotmail.com> wrote in message
news:1129749048.607189.307420@.g44g2000cwa.googlegroups.com...
> Hi,
> I have a complicated question that I'm hoping someone can help me out
> with. I have a webpage that contains a plug-in. This plug-in can
> communicate/pass data with the webpage that contains it via javascript.
> What I need to be able to do is take that data passed via javascript
> and, using vb.net as the code behind language, send it to a database
> without posting it because when I post, the plugin is reloaded and
> starts at the beginning. Specifcally, the plug-in is a type of
> educational program, when the user completes a certain objective in the
> program, I need to store that info in the database but not have the
> program start back at the beginning.
> What happens currently is upon completing the objective in the plugin,
> a javascript function is called in the containing webpage. That
> javascript function changes the data in a hidden field runat the
> server. I artificially create a postback using the
> document.forms.submit() function, then in the page_load function in the
> codebehind page I check the value of the hidden field and store it to
> the database. This works fine. The problem is that when the page
> reloads, my plug-in is reloaded and instead of the user being at say
> level 6, they are back at the initial level 1. Ideally, I would like to
> send the information to the database without having to reload the page
> and was wondering if this was possible.
> Thanks in advance and I'll be happy to clarify any questions.
> Andy
>
the easiest approach is a hidden iframe/frame.
1) the src of the hidden frame should be an aspx page with hidden fields.
the clientscript would fill in the hidden fields in the frame, and do a
submit of the frame.
2) create an addtional form (nonserver) on the page with the target the
hidden frame, have the client script fill in the hidden fields in the form
and do a submit.
-- bruce (sqlwork.com)
"Andy" <acs974@.hotmail.com> wrote in message
news:1129749048.607189.307420@.g44g2000cwa.googlegroups.com...
> Hi,
> I have a complicated question that I'm hoping someone can help me out
> with. I have a webpage that contains a plug-in. This plug-in can
> communicate/pass data with the webpage that contains it via javascript.
> What I need to be able to do is take that data passed via javascript
> and, using vb.net as the code behind language, send it to a database
> without posting it because when I post, the plugin is reloaded and
> starts at the beginning. Specifcally, the plug-in is a type of
> educational program, when the user completes a certain objective in the
> program, I need to store that info in the database but not have the
> program start back at the beginning.
> What happens currently is upon completing the objective in the plugin,
> a javascript function is called in the containing webpage. That
> javascript function changes the data in a hidden field runat the
> server. I artificially create a postback using the
> document.forms.submit() function, then in the page_load function in the
> codebehind page I check the value of the hidden field and store it to
> the database. This works fine. The problem is that when the page
> reloads, my plug-in is reloaded and instead of the user being at say
> level 6, they are back at the initial level 1. Ideally, I would like to
> send the information to the database without having to reload the page
> and was wondering if this was possible.
> Thanks in advance and I'll be happy to clarify any questions.
> Andy
>
Once you're upgraded to ASP.NET 2.0 you can use the
callback feature to do this kind of thing.
Here's more info:
http://www.aspnetpro.com/features/2...p200511so_f.asp
http://www.developer.com/net/asp/article.php/3506896
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Andy" <acs974@.hotmail.com> wrote in message
news:1129749048.607189.307420@.g44g2000cwa.googlegroups.com...
> Hi,
> I have a complicated question that I'm hoping someone can help me out
> with. I have a webpage that contains a plug-in. This plug-in can
> communicate/pass data with the webpage that contains it via javascript.
> What I need to be able to do is take that data passed via javascript
> and, using vb.net as the code behind language, send it to a database
> without posting it because when I post, the plugin is reloaded and
> starts at the beginning. Specifcally, the plug-in is a type of
> educational program, when the user completes a certain objective in the
> program, I need to store that info in the database but not have the
> program start back at the beginning.
> What happens currently is upon completing the objective in the plugin,
> a javascript function is called in the containing webpage. That
> javascript function changes the data in a hidden field runat the
> server. I artificially create a postback using the
> document.forms.submit() function, then in the page_load function in the
> codebehind page I check the value of the hidden field and store it to
> the database. This works fine. The problem is that when the page
> reloads, my plug-in is reloaded and instead of the user being at say
> level 6, they are back at the initial level 1. Ideally, I would like to
> send the information to the database without having to reload the page
> and was wondering if this was possible.
> Thanks in advance and I'll be happy to clarify any questions.
> Andy
>
if you don't need anything back, it's trivial:
var sender = new Image();
sender.src = "whatever.aspx?stufff=1&junkID=27";
Done, and done.
Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/
Get your own Travel Blog, with itinerary maps and photos!
http://www.blogabond.com/
Thanks everyone for their help. It seems that ajax is probably going to
be the way I go. I tried to avoid it since I'm pretty new to this web
programming and didn't understand if it was for me, but it seems that's
what I need long term. One quick question, I've been using asp.net 2.0
but because it is in its beta form, I have avoided exploiting much of
its newer features. How worried do I have to be about creating a
website in 2.0 beta then having it not work on me when the final
release comes out?
Pass value from javascript to vb.net to database without postback...Possible?
I have a complicated question that I'm hoping someone can help me out
with. I have a webpage that contains a plug-in. This plug-in can
communicate/pass data with the webpage that contains it via javascript.
What I need to be able to do is take that data passed via javascript
and, using vb.net as the code behind language, send it to a database
without posting it because when I post, the plugin is reloaded and
starts at the beginning. Specifcally, the plug-in is a type of
educational program, when the user completes a certain objective in the
program, I need to store that info in the database but not have the
program start back at the beginning.
What happens currently is upon completing the objective in the plugin,
a javascript function is called in the containing webpage. That
javascript function changes the data in a hidden field runat the
server. I artificially create a postback using the
document.forms.submit() function, then in the page_load function in the
codebehind page I check the value of the hidden field and store it to
the database. This works fine. The problem is that when the page
reloads, my plug-in is reloaded and instead of the user being at say
level 6, they are back at the initial level 1. Ideally, I would like to
send the information to the database without having to reload the page
and was wondering if this was possible.
Thanks in advance and I'll be happy to clarify any questions.
AndyYou would need to do something like use XMLHTTP to issue a call to a page to
do the work. However, I think that ties you to IE 5.5 and above. This may
or may not be a problem for you.
"Andy" <acs974@.hotmail.com> wrote in message
news:1129749048.607189.307420@.g44g2000cwa.googlegr oups.com...
> Hi,
> I have a complicated question that I'm hoping someone can help me out
> with. I have a webpage that contains a plug-in. This plug-in can
> communicate/pass data with the webpage that contains it via javascript.
> What I need to be able to do is take that data passed via javascript
> and, using vb.net as the code behind language, send it to a database
> without posting it because when I post, the plugin is reloaded and
> starts at the beginning. Specifcally, the plug-in is a type of
> educational program, when the user completes a certain objective in the
> program, I need to store that info in the database but not have the
> program start back at the beginning.
> What happens currently is upon completing the objective in the plugin,
> a javascript function is called in the containing webpage. That
> javascript function changes the data in a hidden field runat the
> server. I artificially create a postback using the
> document.forms.submit() function, then in the page_load function in the
> codebehind page I check the value of the hidden field and store it to
> the database. This works fine. The problem is that when the page
> reloads, my plug-in is reloaded and instead of the user being at say
> level 6, they are back at the initial level 1. Ideally, I would like to
> send the information to the database without having to reload the page
> and was wondering if this was possible.
> Thanks in advance and I'll be happy to clarify any questions.
> Andy
Look at AJAX.net
It may take care of your needs in this case.
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
"Andy" wrote:
> Hi,
> I have a complicated question that I'm hoping someone can help me out
> with. I have a webpage that contains a plug-in. This plug-in can
> communicate/pass data with the webpage that contains it via javascript.
> What I need to be able to do is take that data passed via javascript
> and, using vb.net as the code behind language, send it to a database
> without posting it because when I post, the plugin is reloaded and
> starts at the beginning. Specifcally, the plug-in is a type of
> educational program, when the user completes a certain objective in the
> program, I need to store that info in the database but not have the
> program start back at the beginning.
> What happens currently is upon completing the objective in the plugin,
> a javascript function is called in the containing webpage. That
> javascript function changes the data in a hidden field runat the
> server. I artificially create a postback using the
> document.forms.submit() function, then in the page_load function in the
> codebehind page I check the value of the hidden field and store it to
> the database. This works fine. The problem is that when the page
> reloads, my plug-in is reloaded and instead of the user being at say
> level 6, they are back at the initial level 1. Ideally, I would like to
> send the information to the database without having to reload the page
> and was wondering if this was possible.
> Thanks in advance and I'll be happy to clarify any questions.
> Andy
>
the easiest approach is a hidden iframe/frame.
1) the src of the hidden frame should be an aspx page with hidden fields.
the clientscript would fill in the hidden fields in the frame, and do a
submit of the frame.
2) create an addtional form (nonserver) on the page with the target the
hidden frame, have the client script fill in the hidden fields in the form
and do a submit.
-- bruce (sqlwork.com)
"Andy" <acs974@.hotmail.com> wrote in message
news:1129749048.607189.307420@.g44g2000cwa.googlegr oups.com...
> Hi,
> I have a complicated question that I'm hoping someone can help me out
> with. I have a webpage that contains a plug-in. This plug-in can
> communicate/pass data with the webpage that contains it via javascript.
> What I need to be able to do is take that data passed via javascript
> and, using vb.net as the code behind language, send it to a database
> without posting it because when I post, the plugin is reloaded and
> starts at the beginning. Specifcally, the plug-in is a type of
> educational program, when the user completes a certain objective in the
> program, I need to store that info in the database but not have the
> program start back at the beginning.
> What happens currently is upon completing the objective in the plugin,
> a javascript function is called in the containing webpage. That
> javascript function changes the data in a hidden field runat the
> server. I artificially create a postback using the
> document.forms.submit() function, then in the page_load function in the
> codebehind page I check the value of the hidden field and store it to
> the database. This works fine. The problem is that when the page
> reloads, my plug-in is reloaded and instead of the user being at say
> level 6, they are back at the initial level 1. Ideally, I would like to
> send the information to the database without having to reload the page
> and was wondering if this was possible.
> Thanks in advance and I'll be happy to clarify any questions.
> Andy
Once you're upgraded to ASP.NET 2.0 you can use the cool new client side
callback feature to do this kind of thing.
Here's more info:
http://www.aspnetpro.com/features/2...p200511so_f.asp
http://www.developer.com/net/asp/article.php/3506896
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Andy" <acs974@.hotmail.com> wrote in message
news:1129749048.607189.307420@.g44g2000cwa.googlegr oups.com...
> Hi,
> I have a complicated question that I'm hoping someone can help me out
> with. I have a webpage that contains a plug-in. This plug-in can
> communicate/pass data with the webpage that contains it via javascript.
> What I need to be able to do is take that data passed via javascript
> and, using vb.net as the code behind language, send it to a database
> without posting it because when I post, the plugin is reloaded and
> starts at the beginning. Specifcally, the plug-in is a type of
> educational program, when the user completes a certain objective in the
> program, I need to store that info in the database but not have the
> program start back at the beginning.
> What happens currently is upon completing the objective in the plugin,
> a javascript function is called in the containing webpage. That
> javascript function changes the data in a hidden field runat the
> server. I artificially create a postback using the
> document.forms.submit() function, then in the page_load function in the
> codebehind page I check the value of the hidden field and store it to
> the database. This works fine. The problem is that when the page
> reloads, my plug-in is reloaded and instead of the user being at say
> level 6, they are back at the initial level 1. Ideally, I would like to
> send the information to the database without having to reload the page
> and was wondering if this was possible.
> Thanks in advance and I'll be happy to clarify any questions.
> Andy
if you don't need anything back, it's trivial:
var sender = new Image();
sender.src = "whatever.aspx?stufff=1&junkID=27";
Done, and done.
Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/
--
Get your own Travel Blog, with itinerary maps and photos!
http://www.blogabond.com/
Thanks everyone for their help. It seems that ajax is probably going to
be the way I go. I tried to avoid it since I'm pretty new to this web
programming and didn't understand if it was for me, but it seems that's
what I need long term. One quick question, I've been using asp.net 2.0
but because it is in its beta form, I have avoided exploiting much of
its newer features. How worried do I have to be about creating a
website in 2.0 beta then having it not work on me when the final
release comes out?
Be very worried! Well, not to scare you or anything but seriously, any new
product in beta is not going to be 100% reliable. That's why they call it
alpha, beta.
That being said, you can do a search on google for a list of issues in beta,
that way you can be aware of what's going to work on final release.
"Andy" wrote:
> Thanks everyone for their help. It seems that ajax is probably going to
> be the way I go. I tried to avoid it since I'm pretty new to this web
> programming and didn't understand if it was for me, but it seems that's
> what I need long term. One quick question, I've been using asp.net 2.0
> but because it is in its beta form, I have avoided exploiting much of
> its newer features. How worried do I have to be about creating a
> website in 2.0 beta then having it not work on me when the final
> release comes out?
>
Pass value in "Inherits System.Web.UI.WebControls.DropDownList"?
This is the code I have at this moment:
Public Class ColoredDropDownList
Inherits System.Web.UI.WebControls.DropDownListProtected Overrides Sub RenderContents(ByVal writer As System.Web.UI.HtmlTextWriter)
Dim ...etc..
MyConnection = New SqlConnection(connectionstring)
MyCommand = New SqlDataAdapter("SELECT bgcolor FROM buffer WHERE page='" + Session("fileName").ToString() + "'", MyConnection)
I hope someone can help me. Thanks!You can access them inside a control via Context property which returns reference to the current HttpContext. To access Request or Session that would be Context.Request or Context.Session and so on.
Pass value to function
I have this function:
Sub Add_Menu_Item(ByVal Id As String, ByVal Text() As String)
And I am calling it this way:
Add_Menu_Item("home", {"contact","contacts"})
I get this error:
Compiler Error Message: BC30201: Expression expected.
Why?
Thanks,
Miguel
You have to use it like this:
Add_Menu_Item("home", new string() {"contact","contacts"})