|
Hi all,
I have a TextBox and Button .
The Button have two events 'OnClentClick'(javascript) and 'OnClick'(server side).
OnClientClick of button i could able to set the value to textbox and i could see the value in TextBox.
But when OnClick of Button i could not able to read the changed value of TextBox. Its giving value which i assigned at design time. But i could see the new value in textbox. Why? whats the reason.
How to read that changed value on OnClick(Server Side].
Please suggest me how to do that.
Thanks in advance.
|
|
|
|
|
Can you please show us the code ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Here is the sample code.
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>GridView Export</title>
<script type="text/javascript" language="javascript">
function ChangeText()
{
var tBox = document.getElementById("TextBox1");
tBox.value = "New Text";
alert(tBox.value);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server" Text="Old Text"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" OnClientClick="javascript:ChangeText();" />
</div>
</form>
</body>
</html>
the code behid page:
Firm1.aspx.cs:
protected void Button1_Click(object sender, EventArgs e)
{
Response.write("New Text"+TextBox1.Text);
}
please suggest me where i did wrong.
|
|
|
|
|
Beacuse field value set by javascript it not available in server side code
but you can access value by classical asp pattern
string txtvalue = request.form("fieldname")
|
|
|
|
|
I wanna
counter for my website with ASP.net (C# coding).
How can I do that ?
|
|
|
|
|
Here[^] or here[^] you go.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Sorry
But I didnt get anything .
Can you please give me example or pdf .
|
|
|
|
|
Both the link contain the implementation of Hit counter, even one the link contains the attached code. Then why you are asking for example or pdf ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I wanna to have
Yesterday visitors
Today visitor
Total visitor
<code>Online Visitor</code>
So whats the Solution?
Please Help!!!!!!!!!!!!!!!
|
|
|
|
|
The website contains the login controls which seems to work correctly. i.e. logging in with login details and showing the correct links accordinly...
Question:
How do I make sure on Logout, the user is presented with the Login screen? At present It shows Login or logout. In addition I would like to make sure if the user is not logged in, then he can not browse using the URL. And even if he tries to use the URL, then to see the Login screen.
Thanks
|
|
|
|
|
When your User logs in store the Username to the Session variable and change the login to logout and Change the Icon if you are using icons. When the user logs out set the Session that stored Username to an empty string or use Session.Abondon. Now on page load to have the Correct info Displayed, Check the Session is its not null , if its null then change the the label to logine else to logout.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Not sure how to do the session.abandon and where exactly.
|
|
|
|
|
use this
Session["Username"] = "";
or
Session["Username"].Abondon();
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hello,
I think this is an easier way by placing it in the web.config accordingly
<location path="AddCodes.aspx">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
modified on Monday, January 11, 2010 10:03 AM
|
|
|
|
|
Have something like this:
1. Successful login, set a session variable with the username.
2. On logout link click, set that session variable as -1 and redirect to login page.
3. Set the default value of that session variable as -1 and place a check in all the pages that if that variable is -1, redirect to login page.
PS: Not an ASP.Net developer so there might be far better ways of doing this.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
|
using Session, when login, Session["Username"]="##",
when logout, Session["Username"] = "".
You can check whether Session["Username"] is null to see if the user logged in or not. If Session["Username"]=="", the user didn't log in.
|
|
|
|
|
Hi All,
on clicking on link button(inside datagrid) i got this error
"System.Web.HttpException: The state information is invalid for this page and might be corrupted."
Source Error:
[No relevant source lines]
Don't know why this error ocur, if any one know then please help me
Thanks
prabhakar dwivedi
|
|
|
|
|
Can we see the Gridview Defination. Show us the markup
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Thanks below are the complete deatils of error
I allready clean the asp.net Temporary files.
No relevant source lines]
Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\opensearch\71fa1e73\e4433ca6\App_Web_ezvhodyz.2.cs Line: 0
Stack Trace:
[FormatException: Invalid character in a Base-64 string.]
System.Convert.FromBase64String(String s) +0
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +72
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4
System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37
System.Web.UI.HiddenFieldPageStatePersister.Load() +113
[ViewStateException: Invalid viewstate.
Client IP: 127.0.0.1
Port: 7073
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.3; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2)
ViewState: /wEPDwUKLTg0MjY3NDI4MA9kFgICAQ9kFgQCDQ88KwALAQAPFg4eC18hSXRlbUNvdW50AgMeCERhdGFLZXlzFgAeCFBhZ2VTaXplAgoeCVBhZ2VDb3VudAIBHhVfIURhdGFTb3VyY2VJdGVtQ291bnQCAx4QVmlydHVhbEl0ZW1Db3VudAIDHhBDdXJyZW50UGFnZUluZGV4ZmQWAmYPZBYGAgIPZBYCZg9kFgYCAQ8PFgYeBFRleHQFEyBUZXN0UG9ydGFsID4gSG9tZSAeD0NvbW1hbmRBcmd1bWVudAWLAWh0dHA6Ly9sb2NhbGhvc3QvT3BlblNlYXJjaC9IaWdobGlnaHRlci5hc3B4P0RvY0lkPTIwJkluZGV4PWMlM2ElNWNpbmV0cHViJTVjd3d3cm9vdCU1Y09wZW5TZWFyY2glNWNkdFNlYXJjaCU1Y0ROTlNpdGUxJkhpdENvdW50PTEmaGl0cz0yMCseC0NvbW1hbmROYW1lBV5Eb2NJZD0yMCZJbmRleD1jJTNhJTVjaW5ldHB1YiU1Y3d3d3Jvb3QlNWNPcGVuU2VhcmNoJTVjZHRTZWFyY2glNWNETk5TaXRlMSZIaXRDb3VudD0xJmhpdHM9MjArZGQCAg8VAZwBLi4ua25vd2xlZGdlIEludGVyYWN0IGFuZCBlbmdhZ2Ugd2l0aCBvdGhlciBtZW1iZXJzIG9mIHRoZSBEb3ROZXROdWtlIDxiPmNvbW11bml0eTwvYj4gJiM4M...]
[HttpException (0x80004005): The state information is invalid for this page and might be corrupted.]
System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +106
System.Web.UI.ViewStateException.ThrowViewStateError(Exception inner, String persistedState) +14
System.Web.UI.HiddenFieldPageStatePersister.Load() +217
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +105
System.Web.UI.Page.LoadAllState() +43
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
System.Web.UI.Page.ProcessRequest() +80
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.dtadvancesearch_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\opensearch\71fa1e73\e4433ca6\App_Web_ezvhodyz.2.cs
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
help me
Thanks
prabhakar dwivedi
|
|
|
|
|
Good Day All
i have a Telerik Grid , i think the idea is the same as Normal asp.net grid. its Defined like this
<telerik:RadGrid ID="RagCategories" runat="server" Height="399px" Width="698px" AutoGenerateColumns="False" Skin="Sunset" OnDataBound="RagCategories_DataBound">
<MasterTableView>
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<Columns>
<telerik:GridTemplateColumn DataField="CategoryID" HeaderText="ID" UniqueName="TemplateColumn">
<ItemTemplate>
<asp:Label ID="lblID" Font-Bold="true" runat="server" Text='<%# Eval("CategoryID")%>' ></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Forum Categories" UniqueName="TemplateColumn1">
<ItemTemplate>
<asp:HyperLink id="link1" Text='<%# Eval("CATEGORYNAME")%>' NavigateUrl='<%# Eval("[LINK]")%>' runat="server" > </asp:HyperLink>
<asp:Label ID="descr" runat="server" Text='<%# Eval("Description")%>'></asp:Label>
</ItemTemplate><HeaderStyle Font-Bold="True">
</HeaderStyle>
</telerik:GridTemplateColumn>
</Columns>
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
</MasterTableView>
<FilterMenu EnableTheming="True" Skin="Sunset">
<CollapseAnimation Type="OutQuint" Duration="200">
</CollapseAnimation>
</FilterMenu>
<ClientSettings>
<ClientEvents OnRowClick="OnClientClick="javascript: return SetHidSelectedRows()"" />
</ClientSettings>
</telerik:RadGrid>
in this Grid there is "CategoryID" and on RowDatabound event i hide this Column and it working. now in this Grid i have this
<asp:HyperLink id="link1" Text='<%# Eval("CATEGORYNAME")%>' NavigateUrl='<%# Eval("[LINK]")%>' runat="server" > </asp:HyperLink>
as shown above,when my user clicks the Hyperlink in the Grid, this will take the user to the Appropriate Page,its Good , and i want to save the "CategoryID" of the select Hyperlink.
Thank you
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hai all
i need to move row move rows up or down within the Ultraweb grid on the client side.can any one help me i am using infragistics 2009 vol.2
Thanks.
|
|
|
|
|
What do you mean move up and Down. Please Explain Clearly. i use Infragistics all the time.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
For example if I select the third row of the grid and on clicking the up arrow the third row should move to the second row and the data in the second row should move to the third.
thank you
|
|
|
|
|
Suppose I am having html and in that images tags are used I want to read that tags and get the src i.e file name until the image tag is finished.
|
|
|
|