Re: DataGrid having ListBox and Hyperlink
From: Ollie Riches (ollie.riches_at_phoneanalser.net)
Date: 02/16/05
- Next message: IPGrunt: "Re: What's wrong with this code? Trying to grab a DataReader"
- Previous message: Kevin Spencer: "Re: fail to get Application object???"
- In reply to: Raja: "DataGrid having ListBox and Hyperlink"
- Next in thread: Raja: "Re: DataGrid having ListBox and Hyperlink"
- Reply: Raja: "Re: DataGrid having ListBox and Hyperlink"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 16 Feb 2005 16:26:22 -0000
so you when a user selects a entry in the drop down list you want to change
the hyperlink on the post back event?
If so what you want to do is add a handler for the drop down list and do
something like this get the current datagrid item index.
private void ddlXXX_SelectedIndexChanged(object sender, System.EventArgs e)
{
System.Web.UI.WebControls.DataGridItem item = null;
item = ((System.Web.UI.WebControls.DropDownList)sender).Parent.Parent;
int currentIndex = item.ItemIndex;
string newUrl = "<MAKE URL>";
System.Web.UI.WebControls.HyperLink link = null;
System.Web.UI.WebControls.HyperLink =
(System.Web.UI.WebControls.HyperLink)item.FindControl("PocketDetails'");
link.NavigateUrl = newUrl;
}
-- HTH Ollie Riches http://www.phoneanalyser.net Disclaimer: Opinions expressed in this forum are my own, and not representative of my employer. I do not answer questions on behalf of my employer. I'm just a programmer helping programmers. "Raja" <Raja@discussions.microsoft.com> wrote in message news:FD17079E-EA5C-449C-842F-290441E74255@microsoft.com... > I have a datagrid, it has dropdown box as a column and i have one more column > that has hyperlink. The NavigateURL for the hyperlink is to open a new window > with a query stirng parameter as the selected value of the drop down... > > here is how it looks like > > <asp:datagrid....> > ... > <asp:TemplateColumn> > <ItemTemplate> > <asp:ListBox > ID="ItemList" Runat="server" > AutoPostBack="True" > OnSelectedIndexChanged="DropDown_SelectedIndexChanged"/> > </ItemTemplate> > </asp:TemplateColumn> > <asp:TemplateColumn> > <ItemTemplate> > <asp:hyperlink runat='server' id='PocketDetails'/asp:hyperlink> > </ItemTemplate> > </asp:TemplateColumn> > > ... > </asp:datagrid> > > The url for the hyperlink contorl ("PocketDetails") has to be created > dynamically and with the querysting parameter as the selected value of > dropdown box ("ItemList"). > > How do I achieve this? > > Thanks for your help
- Next message: IPGrunt: "Re: What's wrong with this code? Trying to grab a DataReader"
- Previous message: Kevin Spencer: "Re: fail to get Application object???"
- In reply to: Raja: "DataGrid having ListBox and Hyperlink"
- Next in thread: Raja: "Re: DataGrid having ListBox and Hyperlink"
- Reply: Raja: "Re: DataGrid having ListBox and Hyperlink"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|