Click here to Skip to main content
15,886,519 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionSession or Viewstate Pin
Nishant Singh25-Dec-08 2:02
Nishant Singh25-Dec-08 2:02 
AnswerRe: Session or Viewstate Pin
Abhijit Jana25-Dec-08 2:07
professionalAbhijit Jana25-Dec-08 2:07 
GeneralRe: Session or Viewstate Pin
Nishant Singh25-Dec-08 2:19
Nishant Singh25-Dec-08 2:19 
AnswerRe: Session or Viewstate Pin
Christian Graus25-Dec-08 14:50
protectorChristian Graus25-Dec-08 14:50 
AnswerRe: Session or Viewstate Pin
Aman Bhullar25-Dec-08 18:15
Aman Bhullar25-Dec-08 18:15 
QuestionForm Authentication using as.net 2.0 Pin
sbua24-Dec-08 23:37
sbua24-Dec-08 23:37 
AnswerRe: Form Authentication using as.net 2.0 Pin
Abhijit Jana24-Dec-08 23:41
professionalAbhijit Jana24-Dec-08 23:41 
Questionhow to get the value Pin
R111924-Dec-08 22:17
R111924-Dec-08 22:17 
Hi,

here is the code:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class MainCategory : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
int y = Convert.ToInt32(Request.QueryString["menu_id"]);

string z = (Request.QueryString["menu_text"]);
string v1 = z.ToUpper();
v1 = v1.Replace(" ", "");
getid();

SqlConnection con = new SqlConnection("Server=.; Database=eclsc; Trusted_Connection=yes");
SqlDataAdapter sda = new SqlDataAdapter("select top 1 "+v1+".image, ID.category_name from "+v1+", ID where where parent_id='"+test1+"' ", con);
DataTable dt = new DataTable();
con.Open();
sda.Fill(dt);
DataView dview = dt.DefaultView;
DataList1.DataSource = dview;
DataList1.DataBind();
con.Close();
}

public void getid()
{
int y = Convert.ToInt32(Request.QueryString["menu_id"]);

SqlConnection con = new SqlConnection("Server=.; Database=eclsc; Trusted_Connection=yes");
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = " select category_id from ID where menuindex='" + y + "' ";
con.Open();
string test1 = cmd.ExecuteScalar().ToString();
con.Close();
}



the error is :test1 is not in current context.I want it in page load
AnswerRe: how to get the value Pin
Abhijit Jana24-Dec-08 22:33
professionalAbhijit Jana24-Dec-08 22:33 
AnswerRe: how to get the value Pin
Christian Graus24-Dec-08 23:50
protectorChristian Graus24-Dec-08 23:50 
GeneralRe: how to get the value Pin
Abhijit Jana24-Dec-08 23:57
professionalAbhijit Jana24-Dec-08 23:57 
GeneralRe: how to get the value Pin
Christian Graus25-Dec-08 0:28
protectorChristian Graus25-Dec-08 0:28 
AnswerRe: how to get the value Pin
Nishant Singh25-Dec-08 2:26
Nishant Singh25-Dec-08 2:26 
Questionhow to get the value of a variable defined in a method, in page load. Pin
R111924-Dec-08 21:43
R111924-Dec-08 21:43 
AnswerRe: how to get the value of a variable defined in a method, in page load. Pin
Nishant Singh24-Dec-08 21:45
Nishant Singh24-Dec-08 21:45 
GeneralRe: how to get the value of a variable defined in a method, in page load. Pin
Tamer Oz24-Dec-08 21:52
Tamer Oz24-Dec-08 21:52 
GeneralRe: how to get the value of a variable defined in a method, in page load. Pin
R111924-Dec-08 21:58
R111924-Dec-08 21:58 
QuestionReport opens back the main screen Pin
Member 580612224-Dec-08 19:43
Member 580612224-Dec-08 19:43 
AnswerIgnore : Repost Pin
Abhijit Jana24-Dec-08 19:49
professionalAbhijit Jana24-Dec-08 19:49 
QuestionReport opens back to the main screen Pin
Member 580612224-Dec-08 18:46
Member 580612224-Dec-08 18:46 
AnswerRe: Report opens back to the main screen Pin
Abhijit Jana24-Dec-08 18:53
professionalAbhijit Jana24-Dec-08 18:53 
GeneralRe: Report opens back to the main screen Pin
Member 580612224-Dec-08 19:32
Member 580612224-Dec-08 19:32 
GeneralRe: Report opens back to the main screen Pin
Abhijit Jana24-Dec-08 19:53
professionalAbhijit Jana24-Dec-08 19:53 
GeneralRe: Report opens back to the main screen Pin
Member 580612224-Dec-08 19:56
Member 580612224-Dec-08 19:56 
GeneralRe: Report opens back to the main screen Pin
Abhijit Jana24-Dec-08 20:06
professionalAbhijit Jana24-Dec-08 20:06 

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.