|
hi! guys this is terrible since a while now i've trying to do a very basic data binding, but i'm failing somewhere.let say in my webpage i have a dropdownlist and a textbox(textArea).so the logic is when a user select a text on the dropdownlist(ddCustom by id) its value should be displayed in the textbox.that it.what i've achieved so far is having the dropdownlist text bound but the value is not loading into the textbox field.
here are my codes
<code>
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
string result = this.validateAll(txtEmail.Text, txtNumbers.Text, txtMessage.Text, txtName.Text, 100);
int resultlen = result.Length;
lblError.Text = resultlen.ToString();
}
else
{
DataSet DsTemplate = new DataSet();
DsTemplate.ReadXml(MapPath(@"~\misc\MessageTemplate.xml"));
ddCustom.DataSource = DsTemplate;
ddCustom.DataTextField = "name";
ddCustom.DataValueField = "text";
ddCustom.DataBind();
}
}
protected void ddCustom_SelectedIndexChanged(object sender, EventArgs e)
{
//txtMessage is the id of the textbox
txtMessage.Text = ddCustom.SelectedItem.value;
}
</code>
sample of the xml file
<?xml version="1.0" encoding="utf-8" ?>
<templates>
<template>
<name>Custom</name>
<text></text>
</template>
<template>
<name>Please call</name>
<text> i'm having a Problem Please call me back at</text>
</template>
<template>
<name>Meeting</name>
<text> the meeting is reported</text>
</template>
<template>
<name>BitrhDay</name>
<text> Happy birth Day</text>
</template>
</templates>
simple isn't it? but don't know.
I'm from php backgroung.i would do that by an ajax stuff or with jquery.But here i'm surely forgetting something or thinking that asp.net would do everything for me.i search on google, w3school and my codes seems to be ok.need help on this.please let me know as soon as you have time to check this.Thank you!
PS:i'm so frustrated i can't do anything else<code></code>
eager to learn
<div class="ForumMod">modified on Friday, July 11, 2008 7:39 AM</div>
|
|
|
|
|
common guys a little help to put me on track please.still waiting
eager to learn
|
|
|
|
|
Add this at the end of Page_Load
ddCustom.Attributes.Add(
"onchange",
"var txtMessage = getElementById('" + txtMessage.ClientID + "');"+
"if(txtMessage)txtMessage.value = this.options[this.selectedIndex].value"
);
This will run on client side.
Your code should also work, but you didn't give us the html from the ASP.NET page.
So... I suppose you did not assign the OnSelectedIndexChanged="ddCustom_SelectedIndexChanged" for your ddCustom <asp:dropdownlist ...="" xmlns:asp="#unknown"> control.
|
|
|
|
|
Pretty pretty cool man it's working without any modification.just copy and paste.You are the man!
thanks.
disturbingly simple.By the way why do you select txtMessage.ClientID instead of txtMessage what i would be tempted to do?
eager to learn
|
|
|
|
|
Because you didn't tell me enough about your application and I wanted to make the code working with just a copy/paste.
Seriously now, if your dropdownlist control is placed inside a repeater or it's a part of a user control (or whatever...) , then the ClientID and ID are different.
|
|
|
|
|
got ya! thanks bro!
eager to learn
|
|
|
|
|
Make sure that for the drop down list "AutoPostback=True is" ther.;
<asp:dropdownlist id="ddCustom" runat="server" autopostback="True" onselectedindexchanged="DropDownList1_SelectedIndexChanged" xmlns:asp="#unknown">;
</asp:dropdownlist>
Thanks,
Arindam D Tewary
|
|
|
|
|
ok bro it's already there. thanks for helping
eager to learn
|
|
|
|
|
How can i upload a file of size 10 gb through .net web application. The working would be similar to the Uploader control which is available with .net fromework.
Remember I need an Web Application to upload a single file of 10-15 Gb. Can anyone help me out from this.
Thanks & Regards
Arunangshu Sarkar
Sr. Software Developer
|
|
|
|
|
Have you tried to use FileUpload control?
Best Regards,
Sam Xavier
www.componentone.com
|
|
|
|
|
Yea I have tried File Uploader Control. But it can upload only upto 2Gb of file size. not more than that
Thanks & Regards
Arunangshu Sarkar
Sr. Software Developer
|
|
|
|
|
I'm happy to throw my 2c in, but what is your actual usage scenario here?
|
|
|
|
|
my seanerio is to upload a video file which will have size of nearly 10 Gb. I tried with Upload Control but once it becomes more than 2GB the server fails.
Thanks & Regards
Arunangshu Sarkar
Sr. Software Developer
|
|
|
|
|
I would suggest you use an FTP class instead to transfer the file. ASP.NET 2.0+ has it's own FTP classes, and there are others freely available for 1.1 via Google..
|
|
|
|
|
|
ArunangshuSarkar wrote: can i upload a file of size 10 gb through .net web application
Wow, that sounds rather excessive
You may want to find a way to upload it in 2GB chunks and have the server side repiece those chunks when done. Consider if you are 4.5GB into the upload and something happens, at least you have the chunks there, so you don't have to re-upload the whole file.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi,
I want to disply my redirected web page url with query string in status bar instead of address bar. What I have to do? Pls help
Tnx in adv.
Balasubramanian K.
|
|
|
|
|
In body tag client side onload event write the following code
window.status = '<%=Request.Url %>';
This will work for you.
|
|
|
|
|
Thank you. It is showing address bar and status bar both. I need in status bar only. What I have to do?
Balasubramanian K.
|
|
|
|
|
When you say address bar you mean where someone would type in the name of a website and go to it?
If you do mean this you cant hide the text but you can hide the entire address bar do you want to do that?
|
|
|
|
|
I dont want to hide the total address bar. Why I'am asking is, I am passing user id as query string. For security purpose, I want to hide the query string only or I want to make that the query string should not be changed. At present, I am unable to use Session state. I can use query string only. Thats' why I'm asking like this. Please give me some idea.....
Balasubramanian K.
|
|
|
|
|
Why cant you use session state
what you are doing is going the long way around not using session state.
There are some articles out there I think on hiding url variables but I would still recommend session state
|
|
|
|
|
The only way to do that is to put your entire application inside a dummy page with only one frame.
Just create a file like
server.com/myapp/default.html
put inside this file this code
<html>
<frameset>
<frame marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" src="default.aspx">
</frameset>
</html>
and that's it.
This way your address bar content will always remain the same.
|
|
|
|
|
Tnx, If I use frameset, I am getting the following msg in client side itself (Validation - IE 6 is not supported the frameset). What I have to do?
Balasubramanian K.
|
|
|
|
|