|
It depends on what method you are using to store the Username/Password of the logged user. If your using sessions, you can check if the username/password session is empty in the page load and redirect him to the login/home page.
|
|
|
|
|
Hi,
My code needs to send a string (error text) to an error page. What's the best way of doing it? The string might be quite long so I want to avoid just sending it as a parameter to the page though that's possible if the error string is short enough.
|
|
|
|
|
The best way is to send an error code which could be used by the error page to get the error description from some kind of key value pair storage
|
|
|
|
|
Thanks, I want to avoid an error code though because I want to display the actual exception detail if I get any and I can't guess as to what exceptions or detail I will get.
My solution is that I've used a session variable instead because I can create it when an exception occurs and clear it after I've displayed it.
|
|
|
|
|
Hi all,
I have two datagrid, one has a list of allowed user of the second datagrid. The second datagrid is an inserting datagrid and it Function properly. Now where my problem is I need to be able to select a particular name and will be able to see whatever the Particular selected user has been inserting in the insert datagrid. So I made the names in Hyperlink and and this is the code I'm using but it's not to be working:
<ItemTemplate>
<asp:HyperLink id=HyperLink1 runat="server" NavigateUrl='../Dash_Board/DashBoard.aspx?Name=<%# DataBinder.Eval(Container.DataItem,"TeamBilling")%>'
Text='<%#DataBinder.Eval(Container.DataItem,"TeamBilling")%>'></asp:HyperLink>
</ItemTemplate>
When I press the Name nothing changing. Where could be the problem?
Thanks.
|
|
|
|
|
I would check your source when you have the page in your browser. Just go to view source. See what is actually in your navigateurl. I am guessing you actually want the code to look something like this:
NavigateUrl='<%# "../Dash_Board/DashBoard.aspx?Name="+DataBinder.Eval(Container.DataItem,"TeamBilling").ToString()%>'
Hope that helps.
Ben
|
|
|
|
|
Thanks Kubben,
It's close to that only that it does not selects What the selected person wrote in the insert Datagrid. other wise now in the view source the URL looks like this:
<a id="dgbilling__ctl2_HyperLink1" href="../Dash_Board/DashBoard.aspx?Name=Claude">Claude</a>
Thanks.
|
|
|
|
|
Hi All,
How can I Export data from dataset to Excel with print layout. when we see this Excel report in print view the page numbers should be appear in the format of [Page x of y].
Please also suggest me how can I add Header and Footer to that Excel report.
I am very pleased if anybody help me regarding this.
Thanks in advance
karthik
-- modified at 9:20 Thursday 19th April, 2007
|
|
|
|
|
Sub Page_Load(ByVal Sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
Dim SQLconn As New SqlConnection("Server=(local)\SQLExpress;Initial Catalog=Test;Integrated Security=True")
SQLconn.Open()
Dim Query As String = "SELECT rawvalue FROM Device1 WHERE device = 'Channel1'"
Dim SelectCmd As New SqlCommand(Query, SQLconn)
Dim result As Boolean
SQLconn.Open()
Dim myDataReader As SqlDataReader
myDataReader = SelectCmd.ExecuteReader()
result = myDataReader.GetBoolean(0)
SQLconn.Close()
ChangeButton(result)
End If
End Sub
Sub ChangeButton(ByVal Status As Boolean)
If Status Then
OnOff.Text = "Press to Close"
Label1.Text = "ON"
Label1.BackColor = Drawing.Color.Green
Else
OnOff.Text = "Press To Open"
Label1.Text = "OFF"
Label1.BackColor = Drawing.Color.Red
End If
End Sub
I have this code to change some properties of a label and a button. The problem is that I get and error while debbugging this in Visual Web Developer.
The error is:
"The connection was not closed. The connection's current state is open."
The problem is in line 21 "SQLconn.Open()"
Stack Trace:
[InvalidOperationException: The connection was not closed. The connection's current state is open.]
System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +56
System.Data.SqlClient.SqlConnection.Open() +229
ASP.mapurls_p2_aspx.Page_Load(Object Sender, EventArgs e) in C:\Websites\Project\MapUrls\p2.aspx:21
System.Web.UI.Control.OnLoad(EventArgs e) +88
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3034
Thanks!
|
|
|
|
|
You have two calls to Open().
|
|
|
|
|
Yes. Thank you.
I deleted "Handles MyBase.Load" and I don't get the error message now.
The problem now is that I don't get any values in my Button and Label controls.
I mean the Boolean value passes to ChangeButton procedure that should initialize the controls.
QLconn.Open()
Dim myDataReader As SqlDataReader
myDataReader = SelectCmd.ExecuteReader()
myDataReader.Read()
result = myDataReader.GetBoolean(0)
myDataReader.Close()
SQLconn.Close()
ChangeButton(result)
Sub ChangeButton(ByVal Status As Boolean)
If Status Then
OnOff.Text = "Press to Close"
Label1.Text = "ON"
Label1.BackColor = Drawing.Color.Green
Else
OnOff.Text = "Press To Open"
Label1.Text = "OFF"
Label1.BackColor = Drawing.Color.Red
End If
End Sub
|
|
|
|
|
Why would you delete the handle from the event??
The only problem you had was that you were opening the connection twice...
|
|
|
|
|
Man. Thank you again!!!!!!
I'm so stupid and blind. I put the handle and it works perfect.
If you have the time can you please explain me why this handle is needed?
|
|
|
|
|
You can name your page load sub to be whatever you like (as long as it has the right method signature). The handles keyword tells the system which function to fun on page load...
If you want some more info, read up on events within asp.net.
|
|
|
|
|
Another problem.
Now I get the following error: <
|
|
|
|
|
hi friends
i have the image in datalist.If click that picture,picture will enlarge and open in popup window.
can u help me??
regards
saravanan
|
|
|
|
|
hi.
i may not be clear or accurate but its my opninion may be you can try ....
make that image also a hyperlink then to that link keep the image u are loading in data grid with fixed size to display in full size in another page in new page
the img contol to display the full image using fixed path and image name using parameter passed to it.
Rama Charan Prasad
"Be happy and Keep smiling.Thats what u want be always.. "
|
|
|
|
|
hi all,
I have a flash application which needs to send values to the server (here asp.net). Also the response from the server is sent again to flash.
Going through the articles i found that the method,sendandload allows two way communication between flash and asp.net.But the problem is that the values are passed to the asp.net page but the page gets loaded again and again.
Thanks in advance
Regards
Anuradha
|
|
|
|
|
I have an application in Asp.net.In my machine sql server2000 and 2005 instaled.
I want to connect my project with sql server 2005.Suppose DB name is BBN,but problem is that this DB name is also exist in sql server2000.Now Plz tell me how can i connect my project with sql server2005.
Thanks in advance......
Sujit
|
|
|
|
|
add key="forumDSN" value="server=sujit;uid=sa;pwd=sa;database=BBN"
This is my connection string.
Sujit
|
|
|
|
|
add key="forumDSN" value="Data Source=SYSARUN\SQLEXPRESS;Initial Catalog=BBN;uid=sa;pwd=sa;Integrated Security=True"/
Please specify the exact server instance like the bolded test.
|
|
|
|
|
I have placed Dropdownlist along with some other controls in Updatepanel in an asp.net application. But, During Async Postback, Dropdownlist is flickering. Can any one help me in this regard.
VijayKrishna
|
|
|
|
|
Hello friends..
I am beginner in asp.net technology. I want to learn how to use Ajax with asp.net. Please give me useful links with easy explaination
-- modified at 7:32 Thursday 19th April, 2007
|
|
|
|
|
|