无法执行网格的命令(编辑,删除,添加新记录) [英] cannot execute the commands (edit,delete,add new record) of a grid

查看:78
本文介绍了无法执行网格的命令(编辑,删除,添加新记录)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我有一个telerik radGrid,它按酒店城市显示所有酒店分支机构管理员的列表.(一个酒店城市具有不同的酒店分支机构)

因此,根据登录的管理员,网格将显示结果.

实际上我有3种od管理员:

1位超级管理员:登录后,网格将分散所有城市的酒店管理员及其分支机构的管理员(实际上这项工作终于完成了)

2城市酒店管理员:登录后,网格显示的结果也正确,但是网格命令(如编辑和删除以及添加新记录)被冻结,无法显示正确的形式(addWebAdminCityBranchForm.ascx).

3家酒店管理员:与城市酒店管理员相同的问题:

提前谢谢您.



包含网格的第一种形式是:

**** asp.net ****


Hello,

i have a telerik radGrid that display the list of all hotel branches admins by hotel city.(a hotel city has different branches of hotels)

so depending of the administrator logged on, the grid show the result.

actually i have 3 kinds od admin:

1-superadmin: when he is logged on, the grid dispaly all cities hotel admin and their branches admin (actually this work finally)

2-city hotel admin : when he is logged on, the grid display also the right results but the grid commands like (edit and delete and add a new record) are freezed and cannot display the right form (addWebAdminCityBranchForm.ascx) .

3-branch hotel admin: same problem of city hotel admin:

Thank you in advance.



the first form that contain the grid is:

****asp.net****


<td valign="top">
    <telerik:RadGrid ID="gvS"  runat="server" DataSourceID="viewAdminCityBranchWebDetails" 

     GridLines="None" AllowPaging="True" AllowSorting="True" 

            Width="99%" AutoGenerateColumns="False"

            ShowStatusBar="True" OnPreRender="RadGrid1_PreRender" 

            OnNeedDataSource="RadGrid1_NeedDataSource" 

            OnUpdateCommand="RadGrid1_UpdateCommand" 

            OnInsertCommand="RadGrid1_InsertCommand" 

            OnDeleteCommand="RadGrid1_DeleteCommand" Skin="Black" 

        ShowGroupPanel="True"  önitemcommand="gvS_ItemCommand">
            
        
<HeaderContextMenu EnableTheming="True">
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</HeaderContextMenu>

        <AlternatingItemStyle BackColor="#CCCCCC" ForeColor="Black" />

        <ItemStyle ForeColor="White" />

<MasterTableView autogeneratecolumns="False" datasourceid="viewAdminCityBranchWebDetails"

EditMode="PopUp" commanditemdisplay="Top" >
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>

<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<GroupByExpressions>
                    <telerik:GridGroupByExpression>
                        <SelectFields>
                            <telerik:GridGroupByField FieldAlias="City" FieldName="City" HeaderText="Hotel City"></telerik:GridGroupByField>
                        </SelectFields>
                        <GroupByFields>
                            <telerik:GridGroupByField FieldName="City"></telerik:GridGroupByField>
                        </GroupByFields>
                    </telerik:GridGroupByExpression>

                    <telerik:GridGroupByExpression>
                        <SelectFields>
                            <telerik:GridGroupByField FieldAlias="Branch" FieldName="Branch" HeaderText="Hotel Branchs"></telerik:GridGroupByField>
                        </SelectFields>
                        <GroupByFields>
                            <telerik:GridGroupByField FieldName="Branch"></telerik:GridGroupByField>
                        </GroupByFields>
                    </telerik:GridGroupByExpression>
</GroupByExpressions>

    <Columns>
        <telerik:GridBoundColumn DataField="Name" HeaderText="Name" 

            SortExpression="Name" UniqueName="Name">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="loginID" DataType="System.Decimal" 

            HeaderText="loginID" ReadOnly="True" SortExpression="loginID" 

            UniqueName="loginID" Visible="false">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="userName" HeaderText="User Name" 

            SortExpression="userName" UniqueName="userName">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="password" HeaderText="Password" 

            SortExpression="password" UniqueName="password">
        </telerik:GridBoundColumn>
         <telerik:GridBoundColumn DataField="userTypeID" HeaderText="userType ID" 

            SortExpression="userTypeID" UniqueName="userTypeID" Visible="false">
        </telerik:GridBoundColumn>
         <telerik:GridBoundColumn DataField="userType" HeaderText="User Type" 

            SortExpression="userType" UniqueName="userType">
        </telerik:GridBoundColumn>

         <telerik:GridBoundColumn DataField="cityID" HeaderText="City ID" 

            SortExpression="cityID" UniqueName="cityID" Visible="false">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="city" HeaderText="City" 

            SortExpression="city" UniqueName="city">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="branchID" HeaderText="Branch ID" 

            SortExpression="branchID" UniqueName="branchID" Visible="false">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="branch" HeaderText="Branch" 

            SortExpression="branch" UniqueName="branch">
        </telerik:GridBoundColumn>

        <telerik:GridBoundColumn DataField="createdDate" DataType="System.DateTime" 

            HeaderText="Created Date" SortExpression="createdDate" UniqueName="createdDate">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="updatedDate" DataType="System.DateTime" 

            HeaderText="Updated Date" SortExpression="updatedDate" UniqueName="updatedDate" DataFormatString="{0:MM/dd/yyyy}" >
        </telerik:GridBoundColumn>
          <telerik:GridEditCommandColumn UniqueName="EditCommandColumn">
                    <ItemStyle Font-Italic="True" Font-Underline="True" ForeColor="#CC3300" />
                    </telerik:GridEditCommandColumn>
                    <telerik:GridButtonColumn CommandName="find" HeaderText="" 

            Text="Delete" UniqueName="column">
                        <ItemStyle Font-Italic="True" Font-Underline="True" ForeColor="#CC3300" />
        </telerik:GridButtonColumn>   
    </Columns>
     <EditFormSettings UserControlName="addWebAdminCityBranchForm.ascx" EditFormType="WebUserControl" CaptionFormatString=" Manage Admin Form" FormStyle-Font-Bold=true >

<FormStyle Font-Bold="True"></FormStyle>

     <PopUpSettings Width="70%" />
                    <EditColumn UniqueName="EditCommandColumn1">
                    </EditColumn>
                </EditFormSettings>
    
</MasterTableView>


                
        <ClientSettings AllowDragToGroup="True">
        </ClientSettings>


                
<FilterMenu EnableTheming="True">
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</FilterMenu>
    </telerik:RadGrid>
        </td>

<td>
 <asp:SqlDataSource ID="viewAdminCityBranchWebDetails" runat="server" 

        ConnectionString="<%$ ConnectionStrings:SmartBookingEngineConn %>" 

        > </asp:SqlDataSource>

      <telerik:RadTextBox ID="txtcityID"  runat="server" Height="28px" Visible="false" Width="197px">
      </telerik:RadTextBox>
      
      <telerik:RadTextBox ID="txtbranchID"  runat="server" Height="28px" Visible="false" Width="197px">
      </telerik:RadTextBox>

       <telerik:RadTextBox ID="txtuser"  runat="server" Height="28px" Visible="false" Width="197px">
      </telerik:RadTextBox>
<telerik:RadAjaxManagerProxy ID="rp"  runat="server">
</telerik:RadAjaxManagerProxy>
</td>



*****c# code ******



*****c# code ******

public string UserName;
       public string UserType;
       protected void Page_Load(object sender, EventArgs e)
       {
           rp.AjaxSettings.AddAjaxSetting(gvS, gvS);
           UserName = Session["uname"].ToString();
           UserType = Session["userType"].ToString();
           if (Session["uname"] != null)
           {
               txtuser.Text = UserType;

                   if (UserType == "SuperAdmin")
                   {
                       viewAdminCityBranchWebDetails.SelectCommand = "SELECT loginID,Name,userName,password,CityID,city,branchID,Branch,userTypeID,userType,createdDate, updatedDate FROM ViewCityBranchWebAdmin";
                       viewAdminCityBranchWebDetails.DataBind();




                   }
                   else if (UserType == "CityAdmin")
                   {
                       txtcityID.Text = Session["cityID"].ToString();

                       viewAdminCityBranchWebDetails.SelectCommand = "SELECT loginID,Name,userName,password,CityID,city,branchID,Branch,userTypeID,userType,createdDate, updatedDate FROM ViewCityBranchWebAdmin Where CityID=@cityID";
                       viewAdminCityBranchWebDetails.SelectParameters.Add("cityID", txtcityID.Text.ToString());
                       viewAdminCityBranchWebDetails.DataBind();




                   }
                   //branches Admin

                   else if (UserType == "Super Admin")
                   {
                       txtcityID.Text = Session["cityID"].ToString();
                       txtbranchID.Text = Session["branchID"].ToString();

                       viewAdminCityBranchWebDetails.SelectCommand = "SELECT loginID,Name,userName,password,CityID,city,branchID,Branch,userTypeID,userType,createdDate, updatedDate FROM ViewCityBranchWebAdmin Where CityID=@cityID and branchID=@branchID";
                       viewAdminCityBranchWebDetails.SelectParameters.Add("cityID", txtcityID.Text.ToString());
                       viewAdminCityBranchWebDetails.SelectParameters.Add("branchID", txtbranchID.Text.ToString());
                       viewAdminCityBranchWebDetails.DataBind();
                   }


           }

           else
           {
               Response.Redirect("frmlogin1.aspx");
           }

       }

protected void RadGrid1_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
       {
           // Insert Command
           .............

       }

protected void RadGrid1_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
       {
          // Update Command
           .............

       }

protected void gvS_ItemCommand(object source, GridCommandEventArgs e)
       {
           if (e.CommandName.ToString() == "find")
           {
               if (e.Item is GridDataItem)
               {
                   GridDataItem item = (GridDataItem)e.Item;
                   string strTxt = item["loginID"].Text.ToString();
                   string mysql = "DELETE from tblAdminCityBranchWebLogin where loginID='" + strTxt + "'";
                   db.sqlServer.executeQuery(mysql);
                   gvS.Rebind();
               }
           }
       }




when i click on ad new record or edit command of the grid view the form: addWebAdminCityBranchForm.ascx is displayed;下面是代码:

****asp.net****




when i click on ad new record or edit command of the grid view the form: addWebAdminCityBranchForm.ascx is displayed; below is the code:

****asp.net****

<table>
    <tr>
      <td width="35%">
            <asp:Label ID="lblMessage" runat="server" ForeColor="Red"></asp:Label>
            <asp:Label ID="lblUserType" runat="server" ForeColor="Red" Visible="False"></asp:Label>
       </td>
    </tr>
    <tr>
        <td width="25%">
            <asp:Label ID="Label1" runat="server" Text="Name"></asp:Label>
        </td>
        <td width="75%">
            <telerik:RadTextBox ID="txtName"  runat="server" 

                Text='<%# DataBinder.Eval( Container, "DataItem.Name"  ) %>' 

                Width="250px">
            </telerik:RadTextBox>
            </td>
    </tr>
    <tr>
        <td width="15%">
            <asp:Label ID="Label25" runat="server" Text="User Name"></asp:Label>
        </td>
        <td width="35%">
            <telerik:RadTextBox ID="txtUserName"  runat="server" 

                Text='<%# DataBinder.Eval( Container, "DataItem.userName"  ) %>' 

                Width="250px">
            </telerik:RadTextBox>
        </td>
    </tr>
    <tr>
        <td width="15%" valign="top">
            <asp:Label ID="Label23" runat="server" Text="Password"></asp:Label>
        </td>
        <td width="35%">
            <telerik:RadTextBox ID="txtPassword"  runat="server" 

                Text='<%# DataBinder.Eval( Container, "DataItem.password"  ) %>' 

                Width="250px">
            </telerik:RadTextBox>
        </td>
    </tr>
    <tr>
        <td width="15%" valign="top">
            <asp:Label ID="Label2" runat="server" Text="City"></asp:Label>
        </td>
        <td width="35%">
          
           <asp:DropDownList ID="ddlCity" runat="server" DataSourceID="tblCity" 

                DataTextField="city" DataValueField="cityID" 

                SelectedValue='<%# Bind("cityID") %>' AutoPostBack="true" 

                AppendDataBoundItems="true" 

                onselectedindexchanged="ddlCity_SelectedIndexChanged">
            <asp:ListItem Text="--Select--" Value=""></asp:ListItem>
            </asp:DropDownList>
            <asp:SqlDataSource ID="tblCity" runat="server" 

                ConnectionString="<%$ ConnectionStrings:SmartBookingEngineConn %>" 

                SelectCommand="SELECT [cityID],[city] FROM [viewCityAdmin]">
            </asp:SqlDataSource>
        </td>
    </tr>
    <tr>
        <td width="15%" valign="top">
            <asp:Label ID="Label3" runat="server" Text="Branch"></asp:Label>
        </td>
        <td width="35%">
          
            <asp:DropDownList ID="ddlBranch" runat="server" DataSourceID="tblBranch" 

                DataTextField="Branch" DataValueField="BranchID">
            <asp:ListItem Text="----" Value=""></asp:ListItem>
            </asp:DropDownList>

            <asp:SqlDataSource ID="tblBranch" runat="server" ConnectionString="<%$ ConnectionStrings:SmartBookingEngineConn %>" SelectCommand="SELECT [BranchID],[Branch] FROM [tblBranch] WHERE ([CityID]=@cityID)">
               <SelectParameters>
                <asp:ControlParameter Name="cityID" ControlID="ddlCity" PropertyName="SelectedValue" Type="String" />
               </SelectParameters>
            </asp:SqlDataSource>
      
          
        </td>
    </tr>
    <tr>
        <td width="15%">
            <asp:Label ID="Label26" runat="server" Text="User Type"></asp:Label>
         </td>
        <td width="35%">
       
            <asp:DropDownList ID="ddlUserType" runat="server" DataSourceID="tblUserType" 

                DataTextField="userType" DataValueField="userTypeID" SelectedValue='<%# Bind("userTypeID") %>' AppendDataBoundItems="True">                           
                 <asp:ListItem Text="--Select--" Value=""></asp:ListItem> 
            </asp:DropDownList>
            <asp:SqlDataSource ID="tblUserType" runat="server" 

                ConnectionString="<%$ ConnectionStrings:SmartBookingEngineConn %>" 

                SelectCommand="SELECT [userTypeID], [userType] FROM [tblUserTypeMaster]">
            </asp:SqlDataSource>
        </td>
    </tr>
    <tr>
        <td width="15%">
             </td>
        <td width="35%">
            <telerik:RadTextBox ID="rid"  runat="server" Height="28px" 

                Text='<%# DataBinder.Eval( Container, "DataItem.loginID"  ) %>' 

                Visible="False" Width="197px">
            </telerik:RadTextBox>
        </td>
    </tr>
    <tr>
        <td width="15%">
             </td>
        <td align="center" width="50%">
            <asp:Button ID="btnUpdate" runat="server" CommandName="Update" 

                onclick="btnUpdate_Click" text="Update" 

                Visible="<%# !(DataItem is Telerik.Web.UI.GridInsertionObject) %>" />
            <asp:Button ID="btnInsert" runat="server" CommandName="PerformInsert" 

                text="Save" Visible="<%# DataItem is Telerik.Web.UI.GridInsertionObject %>" />
            <asp:Button ID="btnCancel" runat="server" causesvalidation="False" 

                commandname="Cancel" text="Cancel" />
        </td>
    </tr>
</table>

推荐答案

ConnectionStrings:SmartBookingEngineConn %>" > </asp:SqlDataSource> <telerik:RadTextBox ID="txtcityID" runat="server" Height="28px" Visible="false" Width="197px"> </telerik:RadTextBox> <telerik:RadTextBox ID="txtbranchID" runat="server" Height="28px" Visible="false" Width="197px"> </telerik:RadTextBox> <telerik:RadTextBox ID="txtuser" runat="server" Height="28px" Visible="false" Width="197px"> </telerik:RadTextBox> < telerik:RadAjaxManagerProxy ID =" =" 服务器" </telerik:RadAjaxManagerProxy> < /td >
ConnectionStrings:SmartBookingEngineConn %>" > </asp:SqlDataSource> <telerik:RadTextBox ID="txtcityID" runat="server" Height="28px" Visible="false" Width="197px"> </telerik:RadTextBox> <telerik:RadTextBox ID="txtbranchID" runat="server" Height="28px" Visible="false" Width="197px"> </telerik:RadTextBox> <telerik:RadTextBox ID="txtuser" runat="server" Height="28px" Visible="false" Width="197px"> </telerik:RadTextBox> <telerik:RadAjaxManagerProxy ID="rp" runat="server"> </telerik:RadAjaxManagerProxy> </td>



*****c# code ******



*****c# code ******

public string UserName;
       public string UserType;
       protected void Page_Load(object sender, EventArgs e)
       {
           rp.AjaxSettings.AddAjaxSetting(gvS, gvS);
           UserName = Session["uname"].ToString();
           UserType = Session["userType"].ToString();
           if (Session["uname"] != null)
           {
               txtuser.Text = UserType;

                   if (UserType == "SuperAdmin")
                   {
                       viewAdminCityBranchWebDetails.SelectCommand = "SELECT loginID,Name,userName,password,CityID,city,branchID,Branch,userTypeID,userType,createdDate, updatedDate FROM ViewCityBranchWebAdmin";
                       viewAdminCityBranchWebDetails.DataBind();




                   }
                   else if (UserType == "CityAdmin")
                   {
                       txtcityID.Text = Session["cityID"].ToString();

                       viewAdminCityBranchWebDetails.SelectCommand = "SELECT loginID,Name,userName,password,CityID,city,branchID,Branch,userTypeID,userType,createdDate, updatedDate FROM ViewCityBranchWebAdmin Where CityID=@cityID";
                       viewAdminCityBranchWebDetails.SelectParameters.Add("cityID", txtcityID.Text.ToString());
                       viewAdminCityBranchWebDetails.DataBind();




                   }
                   //branches Admin

                   else if (UserType == "Super Admin")
                   {
                       txtcityID.Text = Session["cityID"].ToString();
                       txtbranchID.Text = Session["branchID"].ToString();

                       viewAdminCityBranchWebDetails.SelectCommand = "SELECT loginID,Name,userName,password,CityID,city,branchID,Branch,userTypeID,userType,createdDate, updatedDate FROM ViewCityBranchWebAdmin Where CityID=@cityID and branchID=@branchID";
                       viewAdminCityBranchWebDetails.SelectParameters.Add("cityID", txtcityID.Text.ToString());
                       viewAdminCityBranchWebDetails.SelectParameters.Add("branchID", txtbranchID.Text.ToString());
                       viewAdminCityBranchWebDetails.DataBind();
                   }


           }

           else
           {
               Response.Redirect("frmlogin1.aspx");
           }

       }

protected void RadGrid1_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
       {
           // Insert Command
           .............

       }

protected void RadGrid1_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
       {
          // Update Command
           .............

       }

protected void gvS_ItemCommand(object source, GridCommandEventArgs e)
       {
           if (e.CommandName.ToString() == "find")
           {
               if (e.Item is GridDataItem)
               {
                   GridDataItem item = (GridDataItem)e.Item;
                   string strTxt = item["loginID"].Text.ToString();
                   string mysql = "DELETE from tblAdminCityBranchWebLogin where loginID='" + strTxt + "'";
                   db.sqlServer.executeQuery(mysql);
                   gvS.Rebind();
               }
           }
       }




when i click on ad new record or edit command of the grid view the form: addWebAdminCityBranchForm.ascx is displayed;下面是代码:

****asp.net****




when i click on ad new record or edit command of the grid view the form: addWebAdminCityBranchForm.ascx is displayed; below is the code:

****asp.net****

<table>
    <tr>
      <td width="35%">
            <asp:Label ID="lblMessage" runat="server" ForeColor="Red"></asp:Label>
            <asp:Label ID="lblUserType" runat="server" ForeColor="Red" Visible="False"></asp:Label>
       </td>
    </tr>
    <tr>
        <td width="25%">
            <asp:Label ID="Label1" runat="server" Text="Name"></asp:Label>
        </td>
        <td width="75%">
            <telerik:RadTextBox ID="txtName"  runat="server" 

                Text='<%# DataBinder.Eval( Container, "DataItem.Name"  ) %>' 

                Width="250px">
            </telerik:RadTextBox>
            </td>
    </tr>
    <tr>
        <td width="15%">
            <asp:Label ID="Label25" runat="server" Text="User Name"></asp:Label>
        </td>
        <td width="35%">
            <telerik:RadTextBox ID="txtUserName"  runat="server" 

                Text='<%# DataBinder.Eval( Container, "DataItem.userName"  ) %>' 

                Width="250px">
            </telerik:RadTextBox>
        </td>
    </tr>
    <tr>
        <td width="15%" valign="top">
            <asp:Label ID="Label23" runat="server" Text="Password"></asp:Label>
        </td>
        <td width="35%">
            <telerik:RadTextBox ID="txtPassword"  runat="server" 

                Text='<%# DataBinder.Eval( Container, "DataItem.password"  ) %>' 

                Width="250px">
            </telerik:RadTextBox>
        </td>
    </tr>
    <tr>
        <td width="15%" valign="top">
            <asp:Label ID="Label2" runat="server" Text="City"></asp:Label>
        </td>
        <td width="35%">
          
           <asp:DropDownList ID="ddlCity" runat="server" DataSourceID="tblCity" 

                DataTextField="city" DataValueField="cityID" 

                SelectedValue='<%# Bind("cityID") %>' AutoPostBack="true" 

                AppendDataBoundItems="true" 

                onselectedindexchanged="ddlCity_SelectedIndexChanged">
            <asp:ListItem Text="--Select--" Value=""></asp:ListItem>
            </asp:DropDownList>
            <asp:SqlDataSource ID="tblCity" runat="server" 

                ConnectionString="<%


ConnectionStrings:SmartBookingEngineConn %>" SelectCommand="SELECT [cityID],[city] FROM [viewCityAdmin]"> </asp:SqlDataSource> < /td > < /tr > < tr > < td =" 15%" valign top" > <asp:Label ID="Label3" runat="server" Text="Branch"></asp:Label> < /td > <td width="35%"> <asp:DropDownList ID="ddlBranch" runat="server" DataSourceID="tblBranch" DataTextField="Branch" DataValueField="BranchID"> <asp:ListItem Text="----" Value=""></asp:ListItem> < /asp:DropDownList > <asp:SqlDataSource ID="tblBranch" runat="server" ConnectionString="<%
ConnectionStrings:SmartBookingEngineConn %>" SelectCommand="SELECT [cityID],[city] FROM [viewCityAdmin]"> </asp:SqlDataSource> </td> </tr> <tr> <td width="15%" valign="top"> <asp:Label ID="Label3" runat="server" Text="Branch"></asp:Label> </td> <td width="35%"> <asp:DropDownList ID="ddlBranch" runat="server" DataSourceID="tblBranch" DataTextField="Branch" DataValueField="BranchID"> <asp:ListItem Text="----" Value=""></asp:ListItem> </asp:DropDownList> <asp:SqlDataSource ID="tblBranch" runat="server" ConnectionString="<%


ConnectionStrings:SmartBookingEngineConn %>" SelectCommand="SELECT [BranchID],[Branch] FROM [tblBranch] WHERE ([CityID]=@cityID)"> < SelectParameters > <asp:ControlParameter Name="cityID" ControlID="ddlCity" PropertyName="SelectedValue" Type="String" /> < /SelectParameters > </asp:SqlDataSource> < /td > < /tr > < tr > < td =" 15%" <asp:Label ID="Label26" runat="server" Text="User Type"></asp:Label> < /td > <td width="35%"> <asp:DropDownList ID="ddlUserType" runat="server" DataSourceID="tblUserType" DataTextField="userType" DataValueField="userTypeID" SelectedValue='<%# Bind("userTypeID") %>' AppendDataBoundItems="True"> < asp:ListItem 文本 =" =" > < /asp:ListItem > < /asp:DropDownList > <asp:SqlDataSource ID="tblUserType" runat="server" ConnectionString="<%
ConnectionStrings:SmartBookingEngineConn %>" SelectCommand="SELECT [BranchID],[Branch] FROM [tblBranch] WHERE ([CityID]=@cityID)"> <SelectParameters> <asp:ControlParameter Name="cityID" ControlID="ddlCity" PropertyName="SelectedValue" Type="String" /> </SelectParameters> </asp:SqlDataSource> </td> </tr> <tr> <td width="15%"> <asp:Label ID="Label26" runat="server" Text="User Type"></asp:Label> </td> <td width="35%"> <asp:DropDownList ID="ddlUserType" runat="server" DataSourceID="tblUserType" DataTextField="userType" DataValueField="userTypeID" SelectedValue='<%# Bind("userTypeID") %>' AppendDataBoundItems="True"> <asp:ListItem Text="--Select--" Value=""></asp:ListItem> </asp:DropDownList> <asp:SqlDataSource ID="tblUserType" runat="server" ConnectionString="<%


这篇关于无法执行网格的命令(编辑,删除,添加新记录)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆