|
Hi,
I have create a webcostom control for TextBox and add one property "Xyz".
[Bindable(true)]<br />
[Category("Appearance")]<br />
[DefaultValue("")]<br />
[Localizable(true)]<br />
public string Xyz<br />
{<br />
get<br />
{<br />
String s = (String)ViewState["Xyz"];<br />
return ((s == null) ? String.Empty : s);<br />
}<br />
set<br />
{<br />
ViewState["Xyz"] = value;<br />
}<br />
}<br />
and i have set the value for Xyz from client script like
<br />
function setvalue()<br />
{<br />
form1.txt.Xyz = "Some Text";<br />
}<br />
on postback i want the value which is set from clientscript
but the value is not set.
Is there another way to set the value from clientscript and get it at serverside?
|
|
|
|
|
You don't have to add one more property 'Xyz' for that. You can use Text property of the textbox.
Like on the client side you can set the value like this.
function setvalue()
{
form1.TextBox1.value = "Some Text";
}
and On the server side, you can get this value like this:
string strGetValue = this.TextBox1.Text;
Amit Kumar
HDISM, PGDCA, MCP, MCAD, MCSD
|
|
|
|
|
Hi Amit,
thanx for reply. I know i can use the text property but for some reseason there is another property which i want to set from clientside and get it in serverside. its like i am adding custome attribute to a control and setting the values. its not related to the text but i am setting another value.
I am doing some operation in client side after that i am setting one value for xyz and accessing that value from serverside.
do you know any other way to do it?
Hemant Mane.
|
|
|
|
|
Hi Hemant,
You can use Hidden Field also to set some value on client side and can access these values on server side easily.
Since I don't know what exactly you want to do, I am unable to tell you the exact solution. The other way to proceed is you can mail me directly or can chat with me right now.
my Chat IDs are : amit_chikara2002@hotmail.com and amit_chikara2002@yahoo.com
Regards,
Amit Kumar
HDISM, PGDCA, MCP, MCAD, MCSD
amit_chikara2002@hotmail.com
|
|
|
|
|
Hi to all,
i am new in ASP.Net + C#. A Drop down list does not maintain its view state.Enableviewstate property of this dropdown is true.Please help me.
Thanx in Advance.
sachin Jangir
|
|
|
|
|
Hi there,
How do you know it does not persist its ViewState? How do you use the dropdownlist in your web form?
|
|
|
|
|
Where have you written its code to add values to dropdownlist?
and also check the postback property of the dropdownlist.
Thanks & regards,
Suresh Dayma
Everything Is Possible!
|
|
|
|
|
I am using MSSQL as my backend for ASP.Net.I have to retrieve time from SQL to ASP.Net textbox. The datatype of the field is smalldatetime. The value stored in it is "1/1/1900 12:20:00".How to Retrieve the time "12:20:00" from the field.
Sarvan.M
|
|
|
|
|
You can format the DateTime value into a string with only the time:
timeString = daTime.ToString("HH':'mm':'ss");
---
b { font-weight: normal; }
|
|
|
|
|
DateTime dtTime=Convert.ToDateTime(dateTime);
string strTime=dtTime.ToLongTimeString();
Mahendra
|
|
|
|
|
In MSSQL use Convert function:-
convert(varchar,date,108)
Saloni
|
|
|
|
|
I am having a little trouble with FormsAuthentication. I am trying to allow everyone view my default.aspx page but all other pages you must be authenticated. Do I need to have code in my web.config file that list every page? I prefer to keep everything under the root directory. Can anyone give me a quick example?
Programming is like solving a puzzle!
|
|
|
|
|
You can use the location[^] tag in the web.config file to do the trick.
|
|
|
|
|
Use these lines to drive all the users to your default page
onto the webconfig change the autenthication mode to forms
<authentication mode="Forms">
<forms loginUrl="default.aspx" protection="All"></forms>
keep Learning...
-- modified at 18:10 Monday 11th September, 2006
|
|
|
|
|
I am developing an internet site in ASP.Net and very first page of site is
default.aspx. I am using form authentication and code is as below
<authentication mode="Forms">
<forms name="ABC" path="/" loginUrl="home/default.aspx"
protection="All" timeout="30">
<credentials passwordFormat="Clear">
<user name="Scott" password="Scott" />
</credentials>
</forms>
</authentication>
As per requirement, i want to restrict users so that they can NOT directly navigate to any other page because from default page i am taking and reading user choices which will be used to generate other pages dynamically. So he has to come from default page. I don't have any sign out button in entire application because this is e-commarce site.
Now my probelm is how to expire cookie which is generated by forms authentication, when user access site from default page.
I tried number of option like
1) Expire policy on session end e.g.
Response.Cookies("Gift2IndiaAuth").Expires = DateTime.Now.AddYears(-30)
Response.Cookies("Gift2IndiaAuth").Expires = Now
FormsAuthentication.SignOut()
But no help.....Please suggest some way......
Amit
Amit
|
|
|
|
|
Probelm Resolved --by adding one more session value. This is some workaround but not the correct way...
If you know please let me know.
Cheers
|
|
|
|
|
i wanna ask about control enable me to display article this article could be
word , pdf or html file and this article must be in aportion of my page not in all the page i hope u understand my request
rasha
|
|
|
|
|
I don't know of such a control which allows to do this thing, and also basically you cannot display the contents of the word, pdf documents as part of the web page except you use the iframe element. If you mean you want to mix up the contents of the web page and the article , you may think of converting the article contents to the html markup, then output to the web page.
|
|
|
|
|
i think u r asking about open word,excel file
for that u have no need for any control
just give the path of the file and open in new window
Mahendra
|
|
|
|
|
Just learning asp.net and have a basic question.
I have a list of records that I want to display 10 at a time. I have the SQL for it but how should I do in ASP.net to send the offset where I'm currently at?
Code:
Private mNofRows As Integer = 10<br />
Private mOffset As Integer = 0<br />
<br />
Private Sub AddNavigationHandlers()<br />
Dim vLinkButtonPrev As LinkButton = DirectCast(Me.Form.FindControl("EntryNavigationPrev"), LinkButton)<br />
Dim vLinkButtonNext As LinkButton = DirectCast(Me.Form.FindControl("EntryNavigationNext"), LinkButton)<br />
AddHandler vLinkButtonPrev.Click, AddressOf EntryNavigationPrev_Click<br />
AddHandler vLinkButtonNext.Click, AddressOf EntryNavigationNext_Click<br />
<br />
vLinkButtonPrev.Enabled = mOffset > 1<br />
End Sub<br />
<br />
Public Sub EntryNavigationPrev_Click(ByVal pSender As Object, ByVal pEventArgs As System.EventArgs)<br />
mOffset -= mNofRows<br />
GetRecords(mOffset, mNofRows)<br />
End Sub<br />
<br />
Public Sub EntryNavigationNext_Click(ByVal pSender As Object, ByVal pEventArgs As System.EventArgs)<br />
mOffset += mNofRows<br />
GetRecords(mOffset, mNofRows)<br />
End Sub
I was hoping that I could have the member variables set at first time and then use them as shared to retain the value between postbacks, but this doesn't seem to work.
Should I be using the tag property of the LinkButtons?
Should I be saving the value in a session variable?
Should I be saving the value in a hidden control?
Should I be saving the value server side using a session object to hold the business tier object with state?
|
|
|
|
|
Hi,
The best place for is when calling the SQL in the first instance, for example, your sql/stored procedure should only return 10 records instead of return all the record(s).
|
|
|
|
|
I think you missunderstood me.
My SQL supports 2 parameters, number of records to return and offset from where to return records. EX: Nof=10, Offset=10 will return records 10-19. I will olny return the number of records that I need from the data-tier.
My question is when hitting the linkbutton "next 10 records" and the postback fires, how do I remember the offset variable. For each time I press the "next 10 records" I want to offset counter to increment by 10.
In old ASP I would have submitted the Offset parameter as an appended querystring parameter:
Ex: <a href="List10Records.asp?intOffset=10">next 10 records</a> . How should I do in ASP.net 2.0?
|
|
|
|
|
use page data source. It has currentindex property.
I hope this help you.
Amit
|
|
|
|
|
I should say that I'm not using databinding.
I'm surprised that I havn't got more replies to this as I thought that this would be a simple question.
I will look at the page data source control but I see this as a more general question, to retain a value between postbacks.
I tought the whole idea with code behind was to allow the programmer to utilize more of the same programing thechniques as when writing a WinForms application. I'm surprised that ASP.net cannot handle member variables. Why arenä't these stored and re-initalized by the view state as a controls properties?
|
|
|
|
|
Hi guys
What is wrong with this ReportPath: /Pages/ReportViewer.aspx?Website+Reportingfvisits&rs:Command=Render
FYI: ReportServerUrl: http://server/ReportServer/
I get the following error: The path of the item "/Pages/ReportViewer.aspx?Website+Reportingfvisits&rs:Command=Render" is not valid. The path must be less than 260 characters long and must start with slash. Other restrictions apply. (rsInvalidItemPath)
|
|
|
|