|
got it right,
i put , <%# System.Drawing.ColorTranslator.FromHtml(Eval("ColorCode")) %>
thanks anyway.
|
|
|
|
|
Hi All,
I have two registration form. On filling the first form, a session is created and the user is redirected to the second page. But on second page session becomes null.
I have debug the code and session is successfully created on first page but when redirected to second page session automatically becomes null.
Why this is happening?
Here is the code :
Page1.aspx.cs :
---------------
protected void btnSaveNext_Click(object sender, ImageClickEventArgs e)
{
try{
Session["RowId"] =rowID;
Response.Redirect("Page2.aspx", false);
}
catch{}
}
Page2.aspx.cs :
---------------
protected void Page_Load(object sender, EventArgs e)
{
if (Session["RowId"] == null )
{
Response.Redirect("login.aspx", false);
}
}
Thanks,
|
|
|
|
|
A simple google search(like this[^]) would have helped you.
Anyway, this [^]is the exact explanation to your problem.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hi,
Thanks for this valuable link.But if you see my code i am using the overloaded redirect method.
Please check my code.
Thanks
|
|
|
|
|
I don't suppose you're abandoning the session in the Page_Load event on page 1 (or anywhere else on page 1 for that matter)?
|
|
|
|
|
Server.Transfer() will work.
Education is not a way to escape poverty — it is a way of fighting it.
|
|
|
|
|
I have used server.transfer it works fine but what could be problem with response.redirect(). I am using response.redirect on many pages.
Sometime back response.redirect was working fine. What could be the problem?
|
|
|
|
|
I have a page where i have some client side validations on a button click and also some serverside event. I am using a asp button. I know its doing some server events so postback will occur but is there anyway i can stop that postback? Or do i have to use update panel of ajax only..But I prefer not to use this since it postsback but doesnt show its postbacking!! Please do help
|
|
|
|
|
If you want to have some server side code which should be executed than it will definitely do a Postback.
In this case, you should make use of AJAX.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
user UpdatePanel to avoid that
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
|
If you want to stop a postback, return 'false' on the client side event. Of course, if you stop postback, then your server side code won't run. If you want the server side code to run without any sort of postback, not even AJAX, then you are seriously deluded and need to give up until you've read some basic books, that would make your question retarded. If you want to stop the server side code from running based on a condition in the client side code, just return false to stop the postback.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
hi
in javascript validation function
write return false
so it stops the page excution
|
|
|
|
|
I am using this code to find the value of dynamically created controls
Dim cmd2 As String = ("Select Specification from DefineSpecification where CategoryID=" + id.ToString())
Dim rdr2 As IDataReader = db.ExecuteReader(CommandType.Text, cmd2)
Dim conn As New SqlConnection
Dim cmd As New SqlCommand("Select Count(*) from DefineSpecification Where CategoryID=" + id.ToString(), conn)
conn.ConnectionString = ConfigurationManager.ConnectionStrings("See2Buy").ConnectionString
conn.Open()
Dim count As Int32 = Convert.ToInt32(cmd.ExecuteScalar())
While rdr2.Read
Dim lbl = New Label()
lbl.Width = "140"
lbl.Text = rdr2.Item("Specification")
For counter2 As Integer = 0 To count - count
Dim txtbox As TextBox = DirectCast(Panel4.FindControl("TextBoxID1"), TextBox)
Dim cmd3 As String = "Insert into Specification(CategoryID,ProductName,SpecificationHeading,SpecificationDescription)Values(" & id & ",'" + txtProductName.Text + "','" + lbl.Text + "','" + txtbox.Text + "')"
Dim dbcmd3 As DbCommand = db.GetSqlStringCommand(cmd3)
db.ExecuteNonQuery(dbcmd3)
Next
End While
The error is :Object reference not set to an instance of an object.
|
|
|
|
|
KhandelwalA wrote: Object reference not set to an instance of an object.
The meaning of this error is that an object which you are using is not initialized i.e. it is NULL(Nothing is VB.Net).
Most likely, it looks to me that rdr2 might me NULL in some cases.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Because your code sucks. In SO many ways, but in this instance, because it grabs all sorts of items and doesn't ever check for success before using them
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Christian Graus wrote: Because your code sucks
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
When I tried to open the file's which may be .doc or excel or any type of file I got the following error "Thread was being aborted..." in the below line of code
Response.Redirect( @"Documents/" + strFileName);------------------------------------------------------------------
First I read the file and saved the data into the database in a binary field
The below lines of code I have used for open the page
try
{
string strFileName = string.Empty;
objTarget.EmpNumaber = empID;
objTarget.DocName = documentName;
SqlDataReader sqlDr = objTarget.AppraiseeDetails();
while (sqlDr.Read())
{
strFileName = sqlDr["DocumentName"].ToString();
//Read binary Data into Bytes Array
byte[] fileBytes = (byte[])sqlDr["Document"];
//Create FileStream Object from for saving file
FileStream oFileStream = new FileStream(Server.MapPath("Documents") + @"\" + strFileName, FileMode.Create);
//SaveFile
oFileStream.Write(fileBytes, 0, fileBytes.Length);
//Dispose the memory of used objects
//Response.Flush();
oFileStream.Flush();
oFileStream.Close();
fileBytes = null;
}
//Close Reader and Connection
sqlDr.Close();
if (strFileName != string.Empty)
{
Response.Redirect( @"Documents/" + strFileName); }
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
I can't able to find out the issue why this Thread was being abortd error message.Please look into the issue and let me know a solution
with regards
Difin Mathew
|
|
|
|
|
Difink wrote: Response.Redirect( @"Documents/" + strFileName);
Should be like this:
Response.Redirect(@"~/Documents/" + strFileName);
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Thanks for the reply
Sorry still I got the same error "Thread was being aborted.."
My file path is
C:\Inetpub\wwwroot\PMPVKL\PMP\Documents\
I was tried this also
Response.Redirect(@"~/~/Documents/" + strFileName).
But got the same error
please advise me
Thanks
Difin
|
|
|
|
|
Are you using threads anywhere ?
Difink wrote: Response.Redirect(@"~/~/Documents/" + strFileName).
That is insane, why would you even try that ? I can only think because you're trying things at random. Do you know what ~ does ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Do you have any other suggestion for the above issue?
|
|
|
|
|
if client don't have font that exist on server . So how to display that information on client with that font .
Sorry for my english !
modified on Monday, July 6, 2009 6:46 AM
|
|
|
|
|
There is a free tool from Microsoft called WEFT 3.2 (Microsoft Web Embedding Fonts Tool).
Microsoft has a web page devoted to this topic...
http://www.microsoft.com/typography/...ame=%20&fsize=
Download link:
http://download.microsoft.com/downlo...WEFTIII2b1.exe
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hi,
Currently we are sending the e-mail using net.mail instead can we have our own email template with images and just modify the dynamic data and can send that email?
Thanks,
S.N.Prasad
S.N.Prasad
|
|
|
|