|
There are a couple of ways to do that:
+ You can use the data binding expression with the Bind method to set the SelectedValue property of the dropdownlist.
+ You can define an Update parameter for the SqlDataSource control, and provide the event handler for the Updating event of the datasource control or the ItemUpdating event of the FormView. In the handler, you can get reference to the dropdownlist to get the selected item, then assign the value to the Update parameter.
|
|
|
|
|
Hi all,
I am working in C#.NET.I want to pick a file name on Button Click event.
Actually when I click on the Button it should open a open file Dialog box as we have when we want to open a document in MS Word or any other and that link should get display in the textbox.
Please help me this.
Thanks in advance.
|
|
|
|
|
protected void button1_Click(object sender, System.EventArgs e)
{
Stream myStream;
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.InitialDirectory = "c:\\" ;
openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" ;
openFileDialog1.FilterIndex = 2 ;
openFileDialog1.RestoreDirectory = true ;
if(openFileDialog1.ShowDialog() == DialogResult.OK)
{
if((myStream = openFileDialog1.OpenFile())!= null)
{
// Insert code to read the stream here.
TextBox1.Text = openFileDialog1.FileName;
myStream.Close();
}
}
}
Praveen
-- modified at 9:30 Friday 23rd June, 2006
|
|
|
|
|
Hi! All,
I used the dropdownlist control to binding the data from database. But I couldn't display all DataTextField because the data too long to display and I can not enlarge to the size of the web control. then I am thinking how the dropdownlist can be displayed all of text. Then I decided to use the tooltip to show the text in downdownlist when the data is binded.
Is there someboby know how to use the tooltip in dropdownlist control in ASP.NET 2.0
thank you for advance
Jib
|
|
|
|
|
probably this article will help you.
http://www.codeproject.com/useritems/xNetComponents.asp
Best Regards,
Apurva Kaushal
|
|
|
|
|
i hv a datagrid ,in that grid i hv dropdwonlist and the list is dynamically populated through database..i wnt to validate the dropdwn list through javascript,the problem is that the dropdwnlist is underthe datagrid and their ids is change hw can i pick that id of the dropdownlist..
and some one tell me that u can pass the id as the parameter...Would some one help me...........
thanks
|
|
|
|
|
One more thing what you can do is call the function on onchange event of the dropdownlist in the ObItemDataBound event of the datagrid and there pass the client ID to the function.
Best Regards,
Apurva Kaushal
|
|
|
|
|
if u dont mind plz send me the code ,bcz i m new in asp.net...how can i use obitemdatabound event of datagrid...plz send me some code snippts
waiting for ur rply
thks
|
|
|
|
|
Onitemdatabound is the event which fires for all the items of the datagrid. In that event first you need to find out the dropdownlist control and then attach the on change event to that.
Here os the code for the onitemdatabound event of the datagrid:
<code>public void test(object sender, DataGridItemEventArgs e)
{
if(e.Item.ItemType==ListItemType.Item || e.Item.ItemType==ListItemType.AlternatingItem)
{
DropDownList dd = (DropDownList)e.Item.FindControl("ddl");
string str = "javascript:return ValFunc(" + dd.ClientID.ToString() + ");";
dd.Attributes.Add("onChange",str);
}
}</code>
And here is the code which will be there in html section:
<code><asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 248px; POSITION: absolute; TOP: 144px"
runat="server" Width="464px" Height="80px" OnItemDataBound="test">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:DropDownList ID="ddl" Runat="server">
<asp:ListItem>oooo</asp:ListItem>
<asp:ListItem>aaa</asp:ListItem>
<asp:ListItem>bbb</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid></code>
And this is the javascript function for validation:
<code><script language=javascript>
function ValFunc(ss)
{
alert(ss.value);
return false;
}
</script></code>
Best Regards,
Apurva Kaushal
-- modified at 3:22 Friday 23rd June, 2006
|
|
|
|
|
thks alot ,u solve my prblem
i m really thnkfull to u?
|
|
|
|
|
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi all,
I am developing website using 2005.when I run my webpage it works fine.BUt when I tried to find my .dll file I could not find it out.
Normally in .net 2003 .dll present in working folder,But this is not true for .net 2005.
Now when I uploading website My web.config file shows error,I think this is due to absence of .dll file.
Error IS
Server Error in '/' Application.
--------------------------------------------------------------------------------
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customerrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customerrors> tag should then have its "mode" attribute set to "Off".
<configuration>
<system.web>
<customerrors mode="Off">
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customerrors> configuration tag to point to a custom error page URL.
<configuration>
<system.web>
<customerrors mode="RemoteOnly" defaultredirect="mycustompage.htm">
Any help is really appreciated.
Regards,
-- modified at 3:41 Friday 23rd June, 2006
|
|
|
|
|
Hi there,
I don't think it's because the absence of the dll file as by default the VS 2005 does not generate the output assembly in the bin folder like you see in the VS 2003 with the ASP.NET 1.1. So you may need to turn off the custom error setting to see the error details which can help figure out the root cause.
Also, if you want to generate the output assemblies for the web site, you can either puslish the web site from the Build menu or use the ASP.NET compile tool aspnet_compiler.exe . Another option is to use the Web Project 2005[^] , for more information you can see Publishing Web Sites[^]
|
|
|
|
|
Hi,
Thanks for help.
Its Really nice to meet such technical savvy and kind people.
I hope we will meet soon with new matter.
Best Regards,
Nagraj
Let's Teach Life To Laugh........
|
|
|
|
|
Hi
i am calling excel sheet macro from web application but it is giving me Exception that
Message "Programmatic access to Visual Basic Project is not trusted"
Please help me
|
|
|
|
|
heh, I remember this one, I spent few hours to find this dirty MS trick
Run Excel.exe application, go to Tools/Macro/Security, click 'Trusted publishers' tab, check 'Trust access to Visual Basic Project'.
Unfortunately, this can not be set programaticaly, AFAIK.
I'm using MS Office 2003, but should works similary with others versions as well.
|
|
|
|
|
i have got an application which is meant to be truely hacakable and in that i have got aspx pages. the html view of the pages when validated by W3C html validator generates a lot of errors in the tags .how can i remove these errors.
Irshad Ahmad
|
|
|
|
|
W3C validator gives you error description along with some suggestion.Follow those suggestions,If suggetions are not available Understand error try to solve it one by one.In many cases solving one problem can automatically solve your more than one problem,so try to solve one by one.
I hope this will help you.
Regards,
Nagaraj
Let's Teach Life To Laugh........
|
|
|
|
|
In VS.NET 2005 go to menu Tools/Options.../Text Editor/HTML/Validation and uncheck 'Show errors'
|
|
|
|
|
Can any one explain me how to coding to use AcroPdf.dll to display PDF files in asp.net application? also for windowsMediaplayer dll in ASP.Net 1.1
thanks in advance
|
|
|
|
|
If you want to work with the pdf document at the server side, you simly right click on the project and choose Add Reference. If you want to open a pdf document or play a media file, the client machine needs to have the pdf viewer/media player installed, and you might be able to host it on your web page using the object[^] element.
|
|
|
|
|
Hi All,
I have a DATE data column in dataset, which gives me date and time both values. i want only date part of that column to display in table. is there any way i can convert it to only date format?
Thanks,
Niki
|
|
|
|
|
You can quickly see the DateTime members[^] providing you with a couple of ways to get the date value only. Also when binding the Date column to the table, you can specify the formatting pattern to get the date, you can read more about this in msdn[^].
|
|
|
|
|
Hello,
I have a form with some checkboxes, I want that whenever the user check a checkbox to post a message to the server and the server will update the Session object.
I don't know how to do it. Please Help.
Thanks,
Yossi
|
|
|
|
|
You can see the sample code[^] of using an Ajax library to access the Session object.
|
|
|
|