<asp:GridView ID="GridView1" runat="server" AllowSorting="True" DataKeyNames="id,Municipio,UF" DataSourceID="SqlDataSource5"> <AlternatingRowStyle BackColor="White" /> <Columns> <asp:CommandField ShowEditButton="True" /> ...stuff... <asp:TemplateField HeaderText="UF" SortExpression="UF"> <EditItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Eval("UF") %>'> </asp:Label> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("UF") %>'> </asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Municipio" SortExpression="Municipio"> <EditItemTemplate> <asp:Label ID="Label2" runat="server" Text='<%# Eval("Municipio") %>'></asp:Label> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label2" runat="server" Text='<%# Bind("Municipio") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="People" SortExpression="People"> <ItemTemplate> <asp:Label ID="LbPeople" runat="server" Text='<%# Bind("Cultura") %>'></asp:Label> </ItemTemplate> <EditItemTemplate> <asp:DropDownList ID="DdlPeople" runat="server" AutoPostBack="true" DataSourceID="SqlDataSourcePeopleEdit" DataTextField="People" DataValueField="People"> </asp:DropDownList> <asp:HiddenField ID="Hidden1" Value='<%# Bind("Municipio") %>' runat="server"/> <asp:HiddenField ID="Hidden2" Value='<%# Bind("UF") %>' runat="server"/> <asp:SqlDataSource ID="SqlDataSourcePeopleEdit" runat="server" ConnectionString="<%$ ConnectionStrings:dbdb %>" ProviderName="<%$ ConnectionStrings:somar.ProviderName %>" SelectCommand="SELECT People FROM Table_People WHERE (Cidade = @Municipio) AND (UF = @UF)" CancelSelectOnNullParameter="false"> <SelectParameters> <asp:ControlParameter ControlID="Hidden1" Name="Municipio" PropertyName="Value" Type="String" /> <asp:ControlParameter ControlID="Hidden2" Name="UF" PropertyName="Value" Type="String" /> </SelectParameters> </asp:SqlDataSource> </EditItemTemplate> </asp:TemplateField> ...stuff... </asp:GridView>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)