regarding the dropdownlist in the details view
Dear all
I have taken one details view .
################## aspx code ###########
<asp:DetailsView ID="DetailsView1" runat="server" DataSourceID="ObjectDataSource1"
Height="74px" Width="484px" AutoGenerateRows="False" AllowPaging="True">
<Fields>
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="True"
CommandName="Update" ImageUrl="~/images/add_user.JPG" Text="Update" />
<asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="False"
CommandName="Cancel" ImageUrl="~/images/btn_cancel.gif" Text="Cancel" />
</EditItemTemplate>
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="False"
CommandName="Edit" CommandArgument="edit" ImageUrl="~/images/edit.gif" Text="Edit" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="userid" HeaderText="userid" />
<asp:TemplateField HeaderText="firstname">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("firstname") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("firstname") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# Bind("firstname") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="lastname" HeaderText="Last name" />
<asp:BoundField DataField="email" HeaderText="Email" />
<asp:BoundField DataField="password" HeaderText="Pasword" />
<asp:BoundField DataField="profileid" HeaderText="profileid" />
<asp:BoundField DataField="designation" HeaderText="designation" />
<asp:BoundField DataField="teamid" HeaderText="teamid" />
<asp:TemplateField HeaderText="Username">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("username") %>'></asp:TextBox>
<asp:RequiredFieldValidator ControlToValidate="TextBox2" ID="RequiredFieldValidator1" runat="server"
ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("username") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("username") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Role">
<EditItemTemplate>
<asp:DropDownList ID="dropdownlistrole" runat="server" DataTextField="role" DataValueField="roleid">
</asp:DropDownList>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("roleid") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("roleid") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("roleid") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("roleid") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("roleid") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
SelectMethod="GetList" TypeName="ALIAManager.clsUserBL"
UpdateMethod="UpdateData">
<UpdateParameters>
<asp:Parameter Name="userid" Type="Int64" />
<asp:Parameter Name="firstname" Type="String" />
<asp:Parameter Name="lastname" Type="String" />
<asp:Parameter Name="email" Type="String" />
<asp:Parameter Name="username" Type="String" />
<asp:Parameter Name="password" Type="String" />
<asp:Parameter Name="profileid" Type="String" />
<asp:Parameter Name="designation" Type="String" />
<asp:Parameter Name="teamid" Type="String" />
<asp:ControlParameter Direction="Output" Name="roleid" Type="String" PropertyName="selectedvalue" ControlID="DetailsView1$dropdownlistrole" />
</UpdateParameters>
<SelectParameters>
<asp:Parameter Name="SearchFilter" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
##############################
I am using business object to update the details view following is the function that is used in the code behind.
###############
Public Function UpdateData(ByVal userid As Int64, ByVal firstname As String, ByVal lastname As String, ByVal email As String, ByVal username As String, ByVal password As String, ByVal profileid As String, ByVal roleid As String, ByVal designation As String, ByVal teamid As String) As Boolean
Dim objdetails As New ALIABase.clsUser
objdetails = objdetails.adddetails(userid, firstname, lastname, email, username, password, profileid, roleid, designation, teamid)
Dim blnUpdate As Boolean
blnUpdate = AliaDAO.clsUserDAO.UpdateData(objdetails)
Return blnUpdate
End Function
#####################
I want to send the roleid to this function that is selectd in the dropdownlist .Fo that I have taken
<asp:ControlParameter Direction="Output" Name="roleid" Type="String" PropertyName="selectedvalue" ControlID="DetailsView1$dropdownlistrole" />
in the ubdate paramaeter section .But whenever I say update it will not get update with the value selected in the dropdownlist of the role.
Can u please give me solution .
|