|
where?
Ihave tried write in Grid1_command { but there is now e.Handle
can till me the best way to solve at
aj123
|
|
|
|
|
Hi everyone,
My application is something like this.....
I have a TextBox and a Button in my Start Page.
When I click the button TextBox text is assigned to ViewState and the page should redirect to the next page.
In the second page I have a Button to redirect the page to the Start Page.
When I am doing so,I am not getting the text which I entered previously as I used ViewState.
My code is
Page 1:
protected void Page_Load(object sender, EventArgs e)
{
if (ViewState["Name"] != null)
{
txtName.Text = ViewState["Name"].ToString();
}
}
protected void btnEnter_Click(object sender, EventArgs e)
{
ViewState["Name"] = txtName.Text;
Response.Redirect("ViewState2.aspx");
}
Page 2:
protected void btnPrev_Click(object sender, EventArgs e)
{
Response.Redirect("ViewState1.aspx");
}
Help me in this regard.
Thank u
Chandu
|
|
|
|
|
Hi,
K V S Chand wrote: I am not getting the text which I entered previously as I used ViewState.
Yes, You could not get it. B'cos ViewState simply keeps the values between the page postback.
Regards,
Jay
|
|
|
|
|
Thank u.
What u said is right.
My doubt is, if u r developing an application on registration form,where u have many fields to enter.
After filling all the fields you will press Submit or whatever, then the page will PostBack and Insert all the fields into the DataBase.
In this context, if you abserve all the text u entered in the TextBoxes will be their even after the PostBack except RadioButtons,CheckBoxes etc, untill and unless you clear it programatically.
Then what is the need of this ViewState as the Values are unchanged after the PostBack also.
Thank u
Chandu
|
|
|
|
|
Chandu,
K V S Chand wrote: all the text u entered in the TextBoxes will be their even after the PostBack
Yes, it is TRUE. B'cos that control has the Property called 'EnableViewState'; By default it has set to True. So the control itself saves its 'control information' in viewstate. (NOT explicitly required by you). Have you got it?
Regards,
Jay
|
|
|
|
|
Thank u.
Even after I set EnableViewState to False to the TextBox, the text remained same.
What the reason for this?
If I want all the values which I have enter in the Page1 after I moved to a couple of pages and then returned to the Page1, how I can I make it.
Thank u
Chandu
|
|
|
|
|
Thank u.
Even after I set EnableViewState to False to the TextBox, the text remained same.
What the reason for this?
If I want all the values which I have enter in the Page1 after I moved to a couple of pages and then returned to the Page1, how can I make it.
Thank u
Chandu
|
|
|
|
|
Try use Session, instead of ViewState (Or) Pass the textbox Value in URL (Or) PreviousPage.FindControl()
(eg) Session["Value"]=txtbox.Text;
Regards,
Jay
|
|
|
|
|
Yah! I got it.
Thank u
Chandu
|
|
|
|
|
You can use cross page postback to do this in ASP.NET 2.0, otherwise, the viewstate contains only the state of controls that are on that page and have viewstate turned on.
Use the session or the URL to pass stuff between pages otherwise.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
To get a better idear which line in a datagrid will be removed I want to add some data from a gridviewrow to a javascript function
The function is is called CollectData(Person)
{
..... some code
return concatenated_string;
}
In the gridview I want to run the javascript in the OnClientClick event
onClientClick="javascript: return comfirm(CollectData(whatshouldcomehere))"
How can I use the <%#DataBinder.Eval(Container.DataItem, "Person")%> on the whatshouldcomehere spot?
|
|
|
|
|
Hi
1. For calling javascript for an onClick event, you should write code in ItemDataBound event of datagrid as shown below:
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)<br />
{<br />
String strJavascript = "";<br />
strJavascript = "alert('" + e.Item.Cells[0].Text.ToString() + "')";<br />
e.Item.Attributes.Add("Onclick",strJavascript);<br />
}
2. If your bound column 'Person' is at column 2 in the datagrid, then pass e.Item.Cells[1].Text.ToString() as an index starts from 0.
Hope you got it.
Harini
|
|
|
|
|
Thank you. This works nice.
|
|
|
|
|
Hi we can get the values in textbox using textbox.text...,
But same if its in checkbox how to store the value?,
Means if its in checked condition want to store 1 like...,
If its not checked want to store 0 like,
How to do that...,
All sorrows will be forget...,When u think ur most lovable one...,
Mag,
|
|
|
|
|
Hi
CheckboxFieldName.Checked will give true if it is checked otherwise false.
Harini
|
|
|
|
|
No actually i am asking is some thing differ...,
See we can get the values from textbox using textbox.text..,
Using this we can store the values to our table...,
Like that,if checkbox is checked condition,
then want to send 1 value to table...,
Otherwise 0 wnt to send...,
Here i can say if check box is in checked condition i can send flag...,
But i need with out using any flag, we can send the value to our table?,
All sorrows will be forget...,When u think ur most lovable one...,
Mag,
|
|
|
|
|
Hi
Ok then try this
Response.Write(CheckBox1.Checked == true ? "1" : "0");
Harini
|
|
|
|
|
You can implement in this way.....
int value;
if(chkBox_Name.checked == true)
{
value=1;
}
else
{
value=0;
}
Cheers
Chandu
|
|
|
|
|
hi friends
I have three dropdownlist
1.date
2.month
3.year
using <asp:listiltem>i give the date,month,year value in Html
i want to all three store database column DATEOFBIRTH like this(1/1/2007)
can u help me
regards
saravanan
|
|
|
|
|
Hi,
You can use the below user defined function to convert your inputs into DateTime object.
Here, _ex = AM/PM.
public DateTime DateTimeConvertor(string _date, string _hrs, string _min, string _ex)
{
StringBuilder strDateTime=new StringBuilder();
DateTime dt = new DateTime();
strDateTime.Append(_date).Append(" ").Append(_hrs).Append(":").Append(_min).Append(":").Append("00").Append(" ").Append(_ex);
dt = Convert.ToDateTime(strDateTime.ToString());
return dt;
}
Regards,
Jay
|
|
|
|
|
In fact you just need to concat values from three dropdownlist to form a correct date. Is it all about your question...?
|
|
|
|
|
You can write the CommandString like this.....
"INSERT INTO <table_name> (.....,DATEOFBIRTH,.....) VALUES (.....,'"+ddlDate.SelectedItem.Text+"'/'"+ddlMonth.SelectedItem.Text+"'/'"+ddlYear.SelectedItem.Text+"',.....)
ddlDate,ddlMonth,ddlYear are the DropDownList names of the Date,Month,Year resp.
Cheers
Chandu
|
|
|
|
|
Dear All,
I have a problem with a web project i created on VS 2005
I am trying to access it from another computer but it doesn't work, from the same computer it was created on it works fine
I don't have much experience with 2005 projects setup but in 2003 i just used to create the virtual directory in the ISS and call:
http://ComputerName/WebsiteName/Path and all runs fine
On 2005 even if i create a virtual directory for the project i can't access it from outside
Is it related to the ports? And what's the solution?
Thanx in advance
Best Regards
3ala2
|
|
|
|
|
try:
http://IP address/WebsiteName
|
|
|
|
|
it works but the login button doesn't do anything
if i run it from the visual studio the login button enters the code!!!
Best Regards
3ala2
|
|
|
|