|
iam adding items to the dropdownlist using javascript function while loading the page.using the webservice.now when click on save button how can i get the value selected in the dropdownlist in the code behind,my problem is that the value selected in the dropdownlist is getting null when i accessing through code behind
|
|
|
|
|
Show the code for both JavaScript and Codebehind ( just adding item in Dropdown and Retreving from it ).
|
|
|
|
|
in javascript
=============
<script type="text/javascript" language ="javascript" >
function AddItem()
{
var opt = document.createElement("option");
document.getElementById("DropDownList1").options.add(opt);
opt.text="One";
opt.value="One"
var opt = document.createElement("option");
document.getElementById("DropDownList1").options.add(opt);
opt.text="Two";
opt.value="Two"
var opt = document.createElement("option");
document.getElementById("DropDownList1").options.add(opt);
opt.text="Three";
opt.value="Three";
return false;
}
function GetDropDownValue()
{
alert("h")
var ddlValue;
var objControl = document.getElementById('<%=DropDownList1.ClientID %>');
alert(objControl.selectedIndex)
ddlValue=objControl.options[o
bjControl.selectedIndex].value;
document.getElementById('hfldResult').value = ddlValue;
}
</script>
in code behind
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim tJavaScript As String = ""
tJavaScript = "<script language='javascript'>GetDropDownValue();</script>"
Page.ClientScript.RegisterStartupScript(Me.GetType, "abc", tJavaScript)
End Sub
|
|
|
|
|
lakshmichawala wrote: document.getElementById('hfldResult').value = ddlValue;
So, are you accessing this control, or the drop list in your code behind ? You have not posted that code, that I can see.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
ya in hidden field iam giving the ddl selected value but iam getting null while accessing the value
|
|
|
|
|
Are you trying to make it impossible for people to help you ? How about posting the code you use to access the value, the script for the control, etc. Why are you not using the client ID from the server to access the hidden field, but you do for the drop down list ? Have you inserts js code to make sure the right control is being found and it's value set ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I really don't understand what you are doing.
lakshmichawala wrote: var opt = document.createElement("option");
document.getElementById("DropDownList1").options.add(opt);
Where you actual create the DrodownList list?
Sometimes you are get taking
document.getElementById("DropDownList1")
and some time
document.getElementById('<%=DropDownList1.ClientID %>');
Please be specific what is your actual requirement is. As per my understanding You have a Dropdownlist ( Server Side Control ) you add value in the list from JavaScript. Now you want to access the value from Code behind itself. Correct me if I am wrong.
|
|
|
|
|
lakshmichawala wrote: document.getElementById("DropDownList1").options.add(opt);
access your dropdown in javascript
document.getElementById("<%=DropDownList1.ClientID %>").options.add(opt);
I dont think that your value is getting updated in dropdown
Cheers!!
Brij
|
|
|
|
|
tq i hv solved my problem using request.form in my code behind
eg:
request.form("dropdownlist1")
|
|
|
|
|
Great
Cheers!!
Brij
|
|
|
|
|
Hi, i know that i should ask this q from sqlserver not asp.net but plz help
Is there a way to restore only one table from a DB backup.
I need restore one table not database because I have update others tables in this database.
thanks in advance
kinds regards
|
|
|
|
|
Ptvce,
ptvce wrote: i know that i should ask this q from sqlserver not asp.net but plz help
This question is Nothing to do with ASP.NET. The best forum is General Database.
ptvce wrote: Is there a way to restore only one table from a DB backup.
I don't think you can restore only one Table from a database. The beast you to generatet the script for the particualr table and run the script in new table. And For restoring the data inside the table you have instert the using script only.
Thanks.
|
|
|
|
|
thanks ur help, thats right, i solve it
|
|
|
|
|
ptvce wrote: i know that i should ask this q from sqlserver not asp.net
So why did you asked it here?
You cannot restore a single table from the backup. You can:
1. Create a new database and restore entire thing into it. Then copy the needed table from there to actual database.
2. You third party tools that allow you to achieve these things. Probably Hyperbac[^] does that. (Just found it through google. Never even heard of it.).
|
|
|
|
|
|
Rajni_pooni wrote: Forum: ASP.NET
Subject: yj
Sender: Rajni_pooni
Date: Wednesday, July 22, 2009 10:51 AM
yj
Please DONOT Spam.
|
|
|
|
|
my application is not showing dataset visulizer option while debugging. so please tell how i can reset the option to visulize dataset.
modified on Tuesday, July 21, 2009 10:01 PM
|
|
|
|
|
Which version of VS are you using ? I didn't know there was a dataset visualiser built in to start with.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
It comes when you quick watch a DataSet or DataTable . VS will show the data in a grid and it is very handy. However, I rarely use DataSet or DataTables.
|
|
|
|
|
|
Well, I guess it's different to the normal visualisers, that appear in a right click menu. I guess your best bet is a reinstall/repair, if there's a feature that has stopped working.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Is it possible in a GridView to hide the Edit and Delete buttons until a user clicks on the Select button of a row? And to only show the Edit and Delete buttons for the selected row?
|
|
|
|
|
|
That is cool, but I'm not using it for that reason, really.
The idea behind the project is a list of messages to be displayed on a crawl running on the bottom of the screen, therefore order is important. I want to force the user to SELECT a row before editing or deleting it because I need to capture the INDEX of the message so I can alter each message's index that comes after.
For example, 5 messages
INDEX
1
2
3
4
5
if I delete 3, 4 would need to become 3 and 5 become 4.
Using C# the only way I found to get that information is by using the SelectedValue property of MyGridView. Unless there's another way...?
|
|
|
|
|
I have a webservice that takes a byte[] parameter and writes it out to the filesystem. The byte[] is about 120k in length (on average). The webservice can be hit about 20x per minute (so that puts it at about 2.5mb/min). The system administrator is saying this service is causing bottlenecks and other web services/web apps are also failing as a result. He suggest that i change the code to speed up the webservice because it's using up too much resources.
The code is pretty straight forward. I don't understand how this webservice is breaking the other applications/services. I was under the impression that the resource management (thread managment, memory manamgement) is all done under IIS not in the code behind. If i'm not correct what could i possibly do (either in the web.config or code behind) to prevent this from happening. Someone suggested that i monitor the threads in the webservice but that really doesn't make sense to me. I'm totally confused on this subject.
Thanks,
Don't be overcome by evil, but overcome evil with good
|
|
|
|