Click here to Skip to main content
15,895,667 members
Home / Discussions / Web Development
   

Web Development

 
QuestionJavaScript Selection/Range Problem [modified] Pin
Lea Hayes24-Oct-08 0:27
Lea Hayes24-Oct-08 0:27 
AnswerRe: JavaScript Selection/Range Problem Pin
Aman Bhullar3-Nov-08 23:50
Aman Bhullar3-Nov-08 23:50 
QuestionRegular Expression Pin
ganeshMohan23-Oct-08 18:51
ganeshMohan23-Oct-08 18:51 
AnswerRe: Regular Expression Pin
Mohammad Dayyan24-Oct-08 2:47
Mohammad Dayyan24-Oct-08 2:47 
GeneralRe: Regular Expression Pin
Paul Conrad24-Oct-08 5:46
professionalPaul Conrad24-Oct-08 5:46 
QuestionDelegates in C# Pin
jainvidhya8423-Oct-08 3:34
jainvidhya8423-Oct-08 3:34 
AnswerRe: Delegates in C# Pin
Aman Bhullar3-Nov-08 23:55
Aman Bhullar3-Nov-08 23:55 
QuestionCannot retrieve the value from my session (cast type error) Pin
Aldeareao23-Oct-08 2:34
Aldeareao23-Oct-08 2:34 
Hey everyone,

recently I am workign on a project where people are able to search wines and later get them from my database. I store the variables from the search form in Session which i later retrieve in the next page (I couldnt use the query string here since its too small). However i get a problem in retrieving my data.





First of all my search field put the data to a session, here is the code.

public partial class catalogus : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void BTNzoeken_Click(object sender, EventArgs e)
{
Session["searchkleur"] = DDLkleur.SelectedValue;
Session["searchland"] = DDLland.SelectedValue;
Session["searchdruifsoort"] = TXTdruifsoort.Text;
Session["searchregio"] = DDLregio.SelectedValue;
Session["searchjaar"] = TXTjaar.Text;
Session["searchinhoud"] = DDLinhoud.SelectedValue;
Session["searchprijs"] = DDLprijs.SelectedValue;
Session["searchoverig"] = TXToverig.Text;
Session["searchwijnnaam"] = TXTwijnnaam.Text;
Session["searchproducent"] = TXTproducent.Text;

Response.Redirect("resultaten.aspx");
}
}





After this i will arrive at the resultaten.aspx page which holds the following code

public partial class resultaten : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["searchkleur"] != null)
{
string VARkleur = Session["searchkleur"].ToString();
string VARland = Session["searchland"].ToString();
System.Convert.ToInt32(VARland);
string VARdruifsoort = Session["searchdruifsoort"].ToString();
string VARregio = Session["searchregio"].ToString();
string VARjaar = Session["searchjaar"].ToString();
string VARinhoud = Session["searchinhoud"].ToString();
string VARprijs = Session["searchprijs"].ToString();
string VARoverig = Session["searchoverig"].ToString();
string VARwijnnaam = Session["searchwijnnaam"].ToString();
string VARproducent = Session["searchproducent"].ToString();

LBLtest.Text = "Kleur " + VARkleur + "<br />Land " + VARland + "<br />Druifsoort " + VARdruifsoort + "<br />Regio " + VARregio + "<br />Jaar " + VARjaar + "<br />Inhoud " + VARinhoud + "<br />Prijs " + VARprijs + "<br />Overig " + VARoverig + "<br />Wijnnaam " + VARwijnnaam + "<br />Producent " + VARproducent;
}
}
}



and here's my aspx part with the SQL command:

<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ConnectionStrings:WijnhuisMDFConnectionString %>"
SelectCommand="SELECT [text] FROM [texten] WHERE textID = 26">
</asp:SqlDataSource>

<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" BorderStyle="None"
DataSourceID="SqlDataSource2" GridLines="None" Width="240px">
<Columns>

<asp:BoundField DataField="text" HtmlEncode="False" SortExpression="text" />
</Columns>
</asp:GridView>





now i ve got 2 error messages: First one says that my landId cannot be converted to an integer so the session variable i stored as a string can't be converted to an int although i ve told C# to convert it.

2: i get an FormatException was unhandled y user code.

Does anyone know's whats wrong or how to solve it? I can share the project files if needed. Thanks in advance for your help Smile | :)
AnswerRe: Cannot retrieve the value from my session (cast type error) Pin
Ashfield23-Oct-08 23:52
Ashfield23-Oct-08 23:52 
Questionjavascript problem in safari Pin
mynameissuraj22-Oct-08 22:44
mynameissuraj22-Oct-08 22:44 
QuestionDifference between session and static internal Pin
Kartik Rathi22-Oct-08 21:22
Kartik Rathi22-Oct-08 21:22 
AnswerRe: Difference between session and static internal Pin
Mohammad Dayyan26-Oct-08 0:00
Mohammad Dayyan26-Oct-08 0:00 
Question[Message Deleted] Pin
pzn3xq22-Oct-08 5:50
pzn3xq22-Oct-08 5:50 
AnswerCP IGNORE: Posted in THREE forums Pin
leckey22-Oct-08 7:31
leckey22-Oct-08 7:31 
AnswerRe: [Message Deleted] Pin
Mohammad Dayyan25-Oct-08 23:58
Mohammad Dayyan25-Oct-08 23:58 
Question[Message Deleted] Pin
pzn3xq22-Oct-08 5:46
pzn3xq22-Oct-08 5:46 
AnswerCP IGNORE: habitual cross poster Pin
leckey22-Oct-08 7:34
leckey22-Oct-08 7:34 
GeneralRe: CP IGNORE: habitual cross poster Pin
Paul Conrad22-Oct-08 7:51
professionalPaul Conrad22-Oct-08 7:51 
QuestioncontentEditable FireFox Pin
Lea Hayes22-Oct-08 2:55
Lea Hayes22-Oct-08 2:55 
QuestionActive Directory Information Pin
abivpm22-Oct-08 1:28
abivpm22-Oct-08 1:28 
QuestionI'd like to pay a programmer for a few hours of their time. I have a C# gui that I want made into a web page. Pin
Gunnar575921-Oct-08 16:44
Gunnar575921-Oct-08 16:44 
AnswerRe: I'd like to pay a programmer for a few hours of their time. I have a C# gui that I want made into a web page. Pin
Guffa21-Oct-08 20:25
Guffa21-Oct-08 20:25 
AnswerRe: I'd like to pay a programmer for a few hours of their time. I have a C# gui that I want made into a web page. Pin
SeMartens21-Oct-08 23:06
SeMartens21-Oct-08 23:06 
AnswerRe: I'd like to pay a programmer for a few hours of their time. I have a C# gui that I want made into a web page. Pin
Vasudevan Deepak Kumar24-Oct-08 12:34
Vasudevan Deepak Kumar24-Oct-08 12:34 
Questionweb page repaint issue Pin
Arman S.21-Oct-08 9:37
Arman S.21-Oct-08 9:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.