|
hi Abhijit,
read the article ...
good one
thanx
|
|
|
|
|
Your best bet if it's big is to store the ids needed to build it, on the URL perhaps, and then get the data from the DB as needed. keeping viewstate down is a good thing, but using the session too much is also a bad move.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi Nishant
Session v/s Viewstate is quite a good question, but you need to consider two things before you make up your mind.
1. How long you want to retain the DataTable in Memory. i.e. if your site is hosted on shared server then you cannot hold it for more than a 5-10 mins as the services restart and the session is destroyed. So in this case the viewstate is better option. But if you are having dedicated server then opt for session.
2. Why not XML. Create a XML of datatable with unique name, write it to disk and then save the file name in ViewState. You will save both the ViewState and session memory.
|
|
|
|
|
Hi,
Can anyone give me an useful link for form authentication using asp.net 2.0
Thanks
|
|
|
|
|
|
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
|
|
|
|
|
Its seems , you didn't understand your last answer that what other people given.
just do it using View State.
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
if(ViewState["TestVal"] !=null )<br />
<br />
{<br />
}<br />
else<br />
{<br />
string test=ViewState["TestVal"]<br />
<br />
}<br />
}
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();
ViewState["TestVal"]=test1;
con.Close();
}
cheers,
Abhijit
|
|
|
|
|
Please, dear God, tell me no-one is paying for this code.
R1119 wrote: int y = Convert.ToInt32(Request.QueryString["menu_id"]);
This is retarded. Your page will blow up if someone puts a non number on the URL.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Christian Graus wrote: R1119 wrote:
int y = Convert.ToInt32(Request.QueryString["menu_id"]);
-------------------------
Merry Christmas Boss !!
cheers,
Abhijit
|
|
|
|
|
Merry Christmas, have a good one.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
return the value of test1 from getid();
public string 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();
return test1;
}
and on page load use
string test1=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);
as simple as that
|
|
|
|
|
Hi to all,
I created a method outside the page_load.
Now I want the value of that variable which is defined in the method, in Page_load.
thanks.....
|
|
|
|
|
either make that Variable Global .....or store it in some Hidden Field
|
|
|
|
|
if you are trying to get value in same request then declare member as class level. if you are trying to get value after postbacks try using viewstate.
|
|
|
|
|
|
I hv attached the code
window.open(urlstring,'ReportSearch','height=480,width=640,titlebar=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no');
i hv called the code in the button click
|
|
|
|
|
Please Don't Cross Post
cheers,
Abhijit
|
|
|
|
|
I am using asp.net 2005 and crystal report 10.2 version , my problem is when the report opens it is opened behind the main screen .
In my java script i am using window.open() only still it opened back to the main screen . Can any one help me.
|
|
|
|
|
Can you please put the line of code that you have used for opening reports ?
Thanks in advance !!
cheers,
Abhijit
|
|
|
|
|
thank u for the reply
This is the code i hv used to open the report
window.open(urlstring,'ReportSearch','height=480,width=640,titlebar=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no');
i hv called it in the button click
|
|
|
|
|
Just try this,
var CrysWind=window.open(---what ever you have written---)<br />
CrysWind.focus()<br />
cheers,
Abhijit
|
|
|
|
|
already i hv tried this but it didnt works for me .
|
|
|
|
|
is it working fine when you use default popup means, with tool bar, menu bar.
cheers,
Abhijit
|
|
|
|
|
No it didnt work . Is there any other solution for this problem
|
|
|
|
|
Hi all,
I am getting following exception when i send Email.Please help.
FailureSystem.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:25 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception stack trace --- at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at Compose.SendButton_Click(Object sender, EventArgs e) in c:\Users\kavitha\Documents\Visual Studio 2008\WebSites\Message\Compose.aspx.cs:line 133
Thanks.
|
|
|
|
|