|
|
In code which he used to get selectedvalue was good but he said that it returns only first value and i'm curiosity to know how did he solved problem???
|
|
|
|
|
yes exactly I too have the perception that the code was correct. My initial thought was Page.IsPostBack prolem, but as he said it was not. That is why I too am curious to know about the problem.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Apurva Kaushal wrote: My initial thought was Page.IsPostBack
And mine suggest was too
on If Not Page.IsPostBack Then ...
but maybe he refill dropdownlist and called DataBind method in another event and it have returnde first item by default
so waiting it is kassy's turn to answer on our question
|
|
|
|
|
That was only thing which will come in anybody's mind.
albCode wrote: so waiting it is kassy's turn to answer on our question
Seems he is in party mood after getting the solution.
Best Regards,
Apurva Kaushal
|
|
|
|
|
|
What was the problem?
Best Regards,
Apurva Kaushal
|
|
|
|
|
Extract the dropdownlist value that you choose.
value = Dropdownlist.Items[Dropdownlist.SelectedIndex].Value;
keep Learning and you never will be out of date...
|
|
|
|
|
Hi friends,
In my asp.net, webpage1 consists 1 textbox and 1 button and if i click this button it goes to webpage2 and in this page one button and if i click this button it goes to webpage1 but for me the value i entered in the textbox should retain while coming back from webpage2. Please Help. Thanks in Advance.
Thanks & Regards,
Prya
|
|
|
|
|
It is simple
webpage1 code
btn_click()
{
Session["txtName"]=textbox1.Text;
}
page_load()
{
if(Session["txtName"]!=null)
textbox1.Text=Session["txtName"].ToString();
}
|
|
|
|
|
hi kiran,
First, Thanks a lot. I tried but it is not working. In the very first time Page_load() event the value of the session is empty. But for me eventhough the session value is empty it goes inside the loop. Why its happening like this.
Thanks & Regards,
Prya
|
|
|
|
|
If your data is not important then you can send that data using querystring also.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Try this
if(Session["txtName"]!=null&&Session["txtName"].ToString()!="")
textbox1.Text=Session["txtName"].ToString();
|
|
|
|
|
hi kiran,
Very first time its working. But once again when i try to give some other text and back from webform2 then the very first session value is retaining not the latest one i had entered in textbox.
Eg:
FirstTime Textbox value : AAAAAAA
While back from webform2 The textbox has the same value.
SecondTime TextBox Value: BBBBBB
While back from webform2 The textbox has the AAAAAAA.
Thanks & Best Regards,
Prya
|
|
|
|
|
In webform 2
how u r going back to webform1
btn2_click
{
Server.Transfer('webform1.aspx');
}
or
just pressing Back button in IE?
|
|
|
|
|
I am using Response.Redirect("Webform1.aspx") also tried using Server.Transfer("Webform1.aspx"). In both method gives same prob.
Thanks & BestRegards,
Prya
|
|
|
|
|
Try this it's working for me
if(!IsPostBack)
{
if(Session["txtName"]!=null&&Session["txtName"].ToString()!="")
TextBox1.Text=Session["txtName"].ToString();
}
|
|
|
|
|
hi Kiran,
Thank you very much.
Its working for me.
Can you tell me the problem why its happened previously like that.
Thanks & Regards,
Prya
|
|
|
|
|
In the previous code i added one extra line of code
i.e
if(!IsPostBack)
{
}
//The above block of code is executed only for the first time when app started.So that session values will be refreshed.
Thanks & Regards
Kiran Kumar.CH(MCP)
kirankumar.cholleti@exensys.com
9885411778
|
|
|
|
|
Thanks kiran. As I am new to ASP.NET, If any help shall i contact u r mail to ur id? Also, if u dont mind can u give me details for microsoft certification.
Thanks & Regards,
Prya
|
|
|
|
|
you are most welcome,now just send a test mail to me
|
|
|
|
|
hi all,
i'am new to ASP.NET technology, can any explain me when to use session variables and application variables and what is the difference between them
mpk1979
|
|
|
|
|
Please do not repost.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi Friends
I wanted to know, to develop an asp.net application which language is commonly used, is it C# OR Vb. Though there is syntax difference which I see. What else do You Comment on this topic. Out of both which one is the best.. , to develope an highly complexed web application. And which is the ongoing language demanded and supported at the industry level to develope web application using asp.net .
Everyone's Welcomed to Comment
Nikhil Bandekar
Mumbai,
India
|
|
|
|
|
Hi,
Actually it depends up on your taste. Because using both you can develop good applications in asp.net. Although I use c# only but it is again my own preference. Here are some points which has been given by other person(in code project some time back) on why to use C#:
This isn't a slam on VB.NET, but rather, some positives about using C# instead of other .NET languages:
* It's at the forefront of research: most of the language innovation at MS Research is being poured into C#, trickling down to other languages: generics, language integrated query, lambda expressions, expression trees, continuations, extension methods, heck, the whole .NET FCL was written in C#. As it usually goes, other languages get these features trickled down to them, but C# is at the fore.
* The primary language: being the primary .NET language has its perks, such as tools that only work with C#, a majority of books on .NET are C#-based, demos, examples, even tools like the recently released XNA Game Studio are C#-only.
* C#, Java, C++, hey, even Javascript languages transition to one another far more easily than the verbose VB.NET. This means more devs are likely to understand your code, simply because of the fact they are all based on C-like syntax.
* No supporting libraries: VB.NET uses the Microsoft.VisualBasic library and other supporting libraries that bring a lot of ugly cruft over from VB6. No such thing in C#, and is another reason why some .NET tools won't support VB.NET. Again, look at the recent XNA Studio; you can't write VB.NET code on the XBox360 because those extra VB dependencies haven't been ported to the XBox360 platform.
* A fresh start. Unlike VB.NET, we don't have ugly, non-conforming libraries brought over from the old world of VB6, and all the bad practices that originated there.
* C# can do some things VB.NET can't easily do. Need to load a private font? Need fast access to a bitmap's pixels? Need to interop with pointers? All those things can be done natively and easily in C#, but require rather bloated work-arounds in VB.NET.
A private font? Say you've got a great font for your client app. But the font may not be installed on the end-user's system. You *could* embed the font as an app resource, but then you'd have to copy the font into %windir%\fonts directory, and that requires administrator priveleges, not to mention lots of disk access.
What you can instead do is embed the font as a resource in your app, then load it and use it in your app without having to install the font on the target system. This is accomplished through System.Drawing.Text.PrivateFontCollection object. The reason it's difficult to do in VB.NET is becausing adding a font to the private font collection object from an in-memory font requires an IntPtr to the memory location of the font. C# can do this no problem since we can use pointers, VB.NET has trouble doing this; having to resort to using the interop wrappers in the System.Runtime.InteropServices namespace.
Hope you will get some idea with this.
Best Regards,
Apurva Kaushal
|
|
|
|