How to place the link button with in dropdown list??
I want to place the link button with in drop down??can any one tell me how to do??
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Usha RajPosted Apr 7, 2015, 7:05 AM
for (int i = 0; i < GridView1.Rows.Count; i++)
{
DropDownList name = (DropDownList)GridView1.Rows[i].FindControl("ddlaction");
string str = name.ID;
//GridView1.Rows[i].Attributes.Add("onmouseover", "this.className='highlight'");
if ( name.SelectedValue=="1")
{
Response.Redirect("JobApplyingPage.aspx");
}
Here If I want to redirect the page means before I should get the id of particular row(by clicking I should get the id),,for getting the id ,we should mention command Argument right?? but this is possible only with link button
if (name.SelectedValue == "2")
{
// code
}
}
So can any one tell me how to solve this??
Abhishek KumarPosted Apr 7, 2015, 6:45 AM
Try this
<asp:dropdownlist id="DropDownList1" runat="server" autopostback="True" onselectedindexchanged="DropDownList1_SelectedIndexChanged">
<asp:listitem value="Test1.aspx">Test1asp:listitem>
<asp:listitem value="Test2.aspx">Test2asp:listitem>
<asp:listitem value="Test3.aspx">Test3asp:listitem>
asp:dropdownlist>
Code Behind:
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
Response.Redirect(DropDownList1.SelectedValue);
}
Hope thsi will help.
Abhishek