|
You can store your viewstate information in page cache or in session.
Because viewstate is reinitialized when page_load occurs.
Use
Page.Cache["name"]=value;
or
Session object to store your value.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
i have 100 records data... is it possible to store in session?
|
|
|
|
|
pramodgorityala wrote: i stored data in viewstate when i click on another click event in same page view state is cleared....
It is not like, viewstate is always there till the time you are on the same page. Might be somewhere you are clearing by yourself.Debug the code you might get the cause
|
|
|
|
|
hi all,
how to embeded gtalk in my application?
pls give me any urls and any ideas......
|
|
|
|
|
|
thanks for giving information..
i want to complete gtalk messenger in my webpage..
user can enter gmailid and passwords...
|
|
|
|
|
|
Use FileUpload control, upload file to a server location and save that path in DB.
|
|
|
|
|
hi there,
i want to handle Close event of my web browser.
if any one close the browser by using [X] button then i need to execute some code.
I can do it using Page_Unload event but for that i need to repeate same code on each page.
Can i catch the browser closing event in Gobal.ASAX...
so i define code only once ....?
Hope i clear what i want.......
Thanks in advance
koolprasad2003
Rating always..... WELCOME
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
koolprasad2003 wrote: t but for that i need to repeate same code on each page
If you are using master pages in your application, you wont have to write same code on each page.
On other thought, you can create a base page and write code to inject javascript function using ScriptManager. And then make all pages to inherit the base class.
|
|
|
|
|
There is no any permanent connection between your browser
and the server.
So you need to detect browser close event from client side (browser) and
then call server event to execute your code.
You can use master page to avoid writing repeating code on each page.
Find following code for the same.
1. To enable page methods
<asp:scriptmanager id="ScriptManager1" runat="server" enablepagemethods="true" />
2. Detect browser close event.
<body onunload="HandleClose()">
3. Call pagemethods to invoke server side event.
<script language="javascript" type="text/javascript">
function HandleClose()
{
alert("Killing the session on the server!!");
PageMethods.AbandonSession();
}
</script>
4. Define your page methods at server side and call your code.
[WebMethod]
public static void AbandonSession()
{
HttpContext.Current.Session.Abandon();
}
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
If you have a button or an imagebutton in the masterpage you can place the next code in you HandleClose() function:
__doPostBack('<%= Button.UniqueID %>','');
or
__doPostBack('<%= ImageButton.UniqueID %>','');
In that case you come in the OnClick event of the button or the imagebutton and there you can handle the Abandon of your Session
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
|
Hi,
How to call a ModalPopupExtender when clicked on a node of a treeview.
Thankyou,
YPKI
|
|
|
|
|
What is the problem you are facing to opein the modelpopupextender from the node.
You can open from javascript and from codebehind also.
to show from js, set the behaivorid of the extender and show this like
$find('behaviorId').show();
and from codebehind you can use this
ModalPopupExtender1.Show();
|
|
|
|
|
So I am looking at ASP.NET jobs at the moment and a few of them say they are a digital solutions company or digital agency. Does anyone know what they mean by this? I can't check out the companies cause they are all listed by a recruitment agency.
Also when people talk about commercial development experience, does that mean public facing stuff or just dev experience. I previously worked for a finance company developing inhouse software for our employees, I guess that doesn't count?
I have a good few more resume and ASP.NET job related questions, if this is the wrong forum I would be grateful if someone could point me to a better one.
Thanks in advance,
Colum
|
|
|
|
|
ASP.NET, C#
I dynamically generate few textboxes. When click on a submit, the page refresh itself. It hides a Panel with those textboxes and shows another Panel. In that panel I need to get texts from the textboxes in the previous Panel.
I saved generated textboxes to Session and retrieve them back on postback. But I only get the IDs of textboxes - i CANNOT get textbox.Text properties. Looks like .Text properties were not assigned to these textboxes when I click on submit.
With static textboxes this is very simple. Does anyone have a solution on this?
|
|
|
|
|
AliensXY wrote: I dynamically generate few textboxes.
Where did you created the textboxes ?
You need to create the textbox before Page_Load . Best place to create dynamic control is to Pre_Init().
If you create TextBox control After/On Page_Load, it will not able to maintain the post back data. because, before Page_Load Event, in ASP.NET Page Lifecyle two methods called internally they are LoadPastBackData and LoadViewStateData . So, if you are creating the control after/on page_load it won't be part of Control Tree hierarchy which is generated in Page_Init() event. And PostbackData and ViewStateData loads only for those control which are listed in control hierarchy.
|
|
|
|
|
Thanks for your reply. I am still having the same problems.
For better discussion I added some code now.
Now I generate textboxes in Page_Init method. Some extract from code:
TextBox textBox = new TextBox();
textBox.ID = d.Key.ToString();
textBox.TextMode = TextBoxMode.MultiLine;
textBox.Height = Unit.Pixel(107);
textBox.Width = Unit.Pixel(263);
Then I save them in the session object:
Session.Add("1", textBox);
Session.Add("2", textBox2);
Session.Add("3", textBox3);
After submit I recreate them in Page_Init:
TextBox t = (TextBox)Session["0"];
Response.Write(t.ID);
Response.Write(t.Text);
I sucessfuly get all attributes except Text. If I wrote textBox.Text = "something" I would get this text. But I cannot do that since the user has to type the text into the textboxes.
|
|
|
|
|
I haven't done this for years. but I have a linkbutton inside an itemtemplate in a datagrid see below
<ItemTemplate>
<asp:LinkButton ID="lb_edit" runat="server" CommandName="Edit">Edit</asp:LinkButton>
</ItemTemplate>
What I wish to do is show the editTemplate whenever I click the linkbutton anyone remember how to achieve this?
Any help is appreciated.
ASP all the way
|
|
|
|
|
|
Hi
how can I get image size in Kb in asp.net c#.
I'm providing facility to download image in 800*600 or 1024*768 dimension but along with these links I want to display actual size of image in Kb in both dimensions.
thanks
You get the best out of others when you give the best of yourself.
|
|
|
|
|
Try:
byte[] image;
int length = image.Length;
|
|
|
|
|
I have this very simple form to display message how many checkboxes are selcted but it returns error on the very first line of javascript. could someone please help me. I couldn't figure it out what has gone wrong.
Thanks
<body>
<form id="f1" runat="server">
<input type="checkbox" name="Liked" value="Cool Layout" /> Cool Layout
<input type="checkbox" name="Liked" value="Fun Layout" /> Fun Layout
</form>
</body>
</html>
function CheckLikes()
{
alert(document.f1.Liked[0].checked);-------------->return error
boxes = document.f1.Liked.length;
txt = ""
for (i = 0; i < boxes; i++)
{
alert("hello");
if (document.f1.Liked[i].checked)
{
txt = txt + document.f1.Liked[i].value + " "
}
}
if (txt == "")
{
Message = "No Boxes ticked"
}
else
{
Message = ""
}
alert(Message);
return Message
}
|
|
|
|
|
What error? How are you accessing it?
I find it working fine:
function CheckLikes()
{
alert(document.f1.Liked[0].checked);
boxes = document.f1.Liked.length;
}
<form id="f1" runat="server">
<input type="checkbox" name="Liked" value="Cool Layout" /> Cool Layout
<input type="checkbox" name="Liked" value="Fun Layout" /> Fun Layout
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="javascript:CheckLikes()" />
</form>
|
|
|
|