C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

Asp.Net Datagrid DropDownlist automation..


Posted Date: 22 Aug 2007      Posted By: Angelo Arzaga      Member Level: Bronze     Points: 2   Responses: 2



Hello,

This is the case in asp.net. I wanted to link drop downlinks in the datagrid in asp.net. example in the datagrid when the user clicks edit, a dropdown lists will appear that holds store departments, if the user chooses a department and selects it the other two dropdownlist for phone and fax number will automatically change to the number of the selected department then the user clicks update and these are all inside the datagrid. is there a way for this? examples please.





Responses

Author: vadivukarasi    23 Aug 2007Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

U are having 3 dropdownlists at the time of user clicked edit.

If user selects the department, the corresponding phone no and fax no of the particular department should appear.

create the onchange javascript function for the 1st dropdownlist(department)
In the other 2 drop down list u are binding DeptId as value , Phone no and Fax no as display text respectively

In the ItemDataBound of the Datagrid

DropDownList ddldept1 = (DropDownList)e.Item.FindControl("ddlDept");
DropDownList ddlfax1 = (DropDownList)e.Item.FindControl("ddlFaxNo");
DropDownList ddlphone1 = (DropDownList)e.Item.FindControl("ddlPhoneNo");

ddldept1.Attributes["onchange"] = "javascript:selectPhoneFax('"+ddldept1.ClientID+"','"+ddlfax1.ClientID+"','"+ddlphone1.ClientID+"');"



javascript function

function SelectPhoneFax(dept,fax,phone)
{
GetObject(fax).value = Getobject(dept).value;
GetObject(phone).value = Getobject(dept).value;


}
function GetObject(ctrlname)
{
return document.getElementById(ctrlname);
}



Author: Angelo Arzaga    05 Sep 2007Member Level: BronzeRating: 2 out of 52 out of 5     Points: 2

Still unresolved


Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : Design of classes and public interfaces
Previous : Browse button coding
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use