Click here to Skip to main content
15,914,163 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In My Gridview there is a DropdownList(ddlProjectCode1) & a Command Button (cmdButton1)

the code for this command button click is within Griview_RowCommand event.

I want execute this code on selected index change of dropdownList(ddlProjectCode1)

Can you complete the code.

--------------------------------------------------------------------------
C#
protected void ddlProjectCode1_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList ddlthis = (DropDownList)sender;
            GridViewRow gvrow = (GridViewRow)ddlthis.Parent.Parent;

            Button cmdButton1 = (Button)gvrow.FindControl("cmdButton1");
}
Posted
Updated 3-Feb-12 0:09am
v2

1 solution

C#
protected void ddlProjectCode1_OnSelectedIndexChanged(object sender, EventArgs e)
{
    DropDownList ddlthis = (DropDownList)sender;
    GridViewRow gvrow = (GridViewRow)ddlthis.Parent.Parent;
    //Call the command button event
    cmdButton1_OnSelectedIndexChanged(object sender, EventArgs e)
}
 
Share this answer
 
v2
Comments
RDBurmon 3-Feb-12 6:19am    
My +5
Anuja Pawar Indore 3-Feb-12 8:43am    
Added pre tag

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900