View Single Post
  #1 (permalink)  
Old June 12th, 2006, 11:43 AM
extendedram extendedram is offline
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Gridview and DropDownList

Hi,

I have a gridview with a templete field. In the template field is a DropDownList.

Code:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
            AllowSorting="True" AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
            <Columns>
                <asp:HyperLinkField DataNavigateUrlFields="RequestID" DataNavigateUrlFormatString="RequestDetails.aspx?RequestID={0}"
                    DataTextField="ReportTitle" HeaderText="Report Title" SortExpression="ReportTitle" >
                    <HeaderStyle ForeColor="White" />
                </asp:HyperLinkField>
                <asp:BoundField DataField="StatusName" HeaderText="Status" SortExpression="StatusName" >
                    <HeaderStyle ForeColor="White" />
                </asp:BoundField>
                <asp:BoundField DataField="RequestDate" HeaderText="RequestDate" SortExpression="RequestDate" >
                    <HeaderStyle ForeColor="White" />
                </asp:BoundField>
                <asp:TemplateField HeaderText="Request Options">
                    <HeaderStyle ForeColor="White" />
                    <ItemTemplate>
                        <asp:DropDownList ID="ddlRequestOptions" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlRequestOptions_SelectedIndexChanged">
                            <asp:ListItem Selected="True"></asp:ListItem>
                            <asp:ListItem Value="Chg">Change</asp:ListItem>
                            <asp:ListItem Value="Can">Cancel</asp:ListItem>
                            <asp:ListItem Value="Up">Update</asp:ListItem>
                        </asp:DropDownList>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <RowStyle BackColor="#E8E8E8" />
            <HeaderStyle BackColor="#36578C" />
        </asp:GridView>
In the selectedindexchanged event for the drop down list I would like to do something like this:
RequestChange.aspx?RequestID = 12345

The request id would come from the row they used the dropdownlist in.

Thanks
Extended

Reply With Quote