|
|
I am using asp.net + c#.In my form i am using gridview in that i add one dropdownlist and textbox.dropdownlist filled values from database.when i change the selected index of the dropdown list i want to display corresponding datavalue in textbox.
How can i do it.I cant get the row index o the gridview when i select the dropdownlist selectedindex changed event.If anyone know this pls give the code.
|
|
|
|
|
You can use the find control to find the dropdownlist in the gridview
|
|
|
|
|
You can also do it using javascript.
Look at this example code.
HTML Source code
<asp:DropDownList ID="ddl" runat="server" onclick="GetValue(this);">
<asp:ListItem Value="1" Text="One"></asp:ListItem>
<asp:ListItem Value="2" Text="Two"></asp:ListItem>
<asp:ListItem Value="3" Text="Three"></asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="ddltext" runat="server"></asp:TextBox>
Javascript Code
function GetValue(ddlObj)
{
document.getElementById(ddlObj.id + 'text').value=ddlObj.options[ddlObj.selectedIndex].value;
}
please don't forget to vote on the post that helped you.
|
|
|
|
|
The only problem with javascript is that users can disable it in their browser.
|
|
|
|
|
i think u cant understand my problem.I filled dropdownlist with database values.and set datatextfield to "id" and datavalue field to "Name".When i change the index of the dropdownlist i want to fill the text box with corresponding datavalue field of the dropdown list.These dropdown and text box are in grid view.I use that code but u call javascript in onclick event so it display '1' .I think u understand my problem.pls replay to me
|
|
|
|
|
Looking For Selected Value In Dropdownlist In Gridview Using Javascript +asp Net?
|
|
|
|
|
Yes.I understood your problem.I have given you an example.
Put dropdownlist and textbox in ItemTemplate,Bind Dropdownlist with data.
When you select items from dropdownlist,selected item value will be filled in textbox using that javascript.call javascript on onclick event of dropdownlist,you can not call selectedIndexChanged event because it will execute on server side while onclick event will execute on client side.
please don't forget to vote on the post that helped you.
|
|
|
|
|
The datagrid gets populated with data, meaning to say it has no problem with retrieving data from database.
i have added the follwing in the webconfig.
<add key="CommandTimeout" value="60000">
<httpruntime maxrequestlength="2097151" executiontimeout="3600000">
still on exporting the data to excel i get timeout Expired.
code for exporting to excel
Response.Clear();
Response.Buffer = true;
Response.Charset = "";
Response.AddHeader("Content-Disposition", "attachment; filename=Export.xls");
Response.AddHeader("content-disposition", "filename=Export.xls");
Response.ContentType = "application/vnd.ms-excel";
StringWriter stringWriter = new StringWriter();
HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
grdExport.RenderControl(htmlWriter);
htmlWriter.Write(stringWriter );
Response.Write(stringWriter.ToString());
Response.End();
Kindly help.
Thank you.
I live Quarter ahead from time
|
|
|
|
|
Can you schedule a job from ASP.NET so that a background worker process can do that and send an email to the user?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
which database extension file (sdb)
|
|
|
|
|
ServerBoss Database File (Proprietary database format used by multiple versions of ServerBoss; supports file locking to improve performance under heavy loads; ServerBoss setup data is stored in the ServerBoss.sdb file.)
|
|
|
|
|
can u give me link (download the serverboss software)
|
|
|
|
|
|
currently i m using asp.net with c# (.net 2005, 2.0 framework).
here i m having 5 variables (Either int or string) say.... A,B,C,D,E. And the variables contains....
A=1;B=2;C=1;D=3;E=2;
Here, i need the output of the counts of the values...
i.e.,
count1=2 (since, 1 value occur twice in the A,B,C,D,E collection)
count2=2 (since, 2 value occur twice in the A,B,C,D,E collection)
count3=1 (since, 3 value occur only once in the A,B,C,D,E collection)
how to do this? - KARAN
|
|
|
|
|
Build a hashtable, which stores the number as a key, and the number of times it appears as the value. That would be flexible for any numbers that get added to your collection.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
How can i find only the current page gridview rows?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
What do you mean?
You can set the gridview so paging is disabled.
There must be a current page tag you can use as well
|
|
|
|
|
i meant , in my first page , which contains 10 rows , how can i loop only for those ten rows .
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
Hello. I am building an online control panel(back end) for a website, using asp.net - VB. One the things that I have to program, is the user to be able to upload files. But there is one issue. When the user's trying to upload a file that its size is bigger than the allowed size, he gets a "The connection was reset". My question is the following:
How do I face that?
* Do I have to write some code in order to control that? If yes, this code has to do with a HTTP Request or something, or is it something else?
|
|
|
|
|
Yes you need to have following element in Web.config
have added this in web.config ?
if not add it and check
<system.web> <httpRuntime executionTimeout="240" maxRequestLength="20480" /></system.web>
maxRequestLength: Specifies the limit for the input stream buffering threshold, in KB. This limit can be used to prevent denial of service attacks that are caused, for example, by users posting large files to the server. The default is 4096 (4 MB).
executionTimeout:
Specifies the maximum number of seconds that a request is allowed to execute before being automatically shut down by ASP.NET.
This time-out applies only if the debug attribute in the compilation element is False. To help to prevent shutting down the application while you are debugging, do not set this time-out to a large value.
Note
In the .NET Framework versions 1.0 and 1.1, the default is 90.
The default is "00:01:50" (110 seconds).
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hi,
There exists predefined limit on the size of file you can upload, however you can change the size.
By default the maximum size is 4MB. However you can change this value at two places web.config and/or machine.config.
<httpRuntime executionTimeout="90" <br />
maxRequestLength="4096"<br />
useFullyQualifiedRedirectUrl="false"<br />
minFreeThreads="8"<br />
minLocalRequestFreeThreads="4"<br />
appRequestQueueLimit="100"/>
Check for the above in the web.config/machine.config, if you dont find it, add it. Increase the value for maxRequestLength from 4096(4MB) to whatever you want. Remember when you increase maxRequestLength value, you should also change the value for executionTimeOut, this value specifies the number of seconds the upload is allowed by ASP.NET before it stops/shuts down.
Also note if you change the value in machine.config, we will have to reboot the system.
Location of machine.config = \System Root\Microsoft.NET\Framework\Version Number\CONFIG directory
In case you are using ASP.NET 2.0 instead of machine.config you can try out in web.config.comments files, which is present in
root\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG
|
|
|
|
|
To prevent DoS Attacks, ASP.NET breaks the Request when the size of the incoming stream is more than that configured for the application.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
Hi,
I have small project that retrieve Data from Database and fill Datagrid On Page Load. I add Databound Columns for each Columns in the database, and set The AutoGenerateColumns=False, So My Data will be Displayed lik this
StudentName CourseName
John asp.net
Mary mcse
Komar MCSD
Komar A+
Komar 3D Studio
... I need to make Komar appears just one time, so the result Should be like this in the DataGrid
StudentName CourseName
Komar MCSD
A+
3D Studio
How Can I do This, some help Please.
|
|
|
|
|
add DISTINCT to your query for StudentName, this should then just select one unique student name.
|
|
|
|