在C#中的asp.net中的Telerik RadGrid中的自动更新问题? [英] Auto update problem in Telerik RadGrid in asp.net in C#?
问题描述
海...
我将Telerik RadGrid控件与SQLDataSource一起使用...我使用以下代码.
Hai...
I''m Using Telerik RadGrid control with SQLDataSource...I uses the following code..
<telerik:RadGrid ID="RadGrid_Team" runat="server" Skin="Simple"
CellSpacing="0" DataSourceID="SqlDataSource1" GridLines="Vertical"
AllowAutomaticUpdates="True" AllowAutomaticDeletes="true">
<MasterTableView AutoGenerateColumns="False" EditMode="InPlace" DataKeyNames="tid"
DataSourceID="SqlDataSource4" CellPadding="0">
<CommandItemSettings ExportToPdfText="Export to PDF"/>
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
</ExpandCollapseColumn>
<Columns>
<telerik:GridEditCommandColumn UniqueName="EditCommandColumn" UpdateText="Save" />
<telerik:GridNumericColumn DataField="tid" DataType="System.Int32"
FilterControlAltText="Filter tid column" HeaderText="tid" HeaderStyle-Font-Bold="true" ReadOnly="True"
SortExpression="tid" UniqueName="tid" Visible="false">
</telerik:GridNumericColumn>
<telerik:GridNumericColumn DataField="team"
FilterControlAltText="Filter team column" HeaderText="Team#" HeaderStyle-Font-Bold="true"
SortExpression="team" UniqueName="team" ReadOnly="true">
</telerik:GridNumericColumn>
<telerik:GridBoundColumn DataField="name" DataType="System.String"
FilterControlAltText="Filter name column" HeaderText="Team Name" HeaderStyle-Font-Bold="true"
SortExpression="name" UniqueName="name" ColumnEditorID="edittxt_teamname" >
</telerik:GridBoundColumn>
<telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
</telerik:GridButtonColumn>
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
</MasterTableView>
<FilterMenu EnableImageSprites="False"></FilterMenu>
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
</telerik:RadGrid>
<telerik:GridTextBoxColumnEditor ID="edittxt_teamname" runat="server">
<TextBoxStyle Width="85" />
</telerik:GridTextBoxColumnEditor>
<asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT tid,team,name from table1"
DeleteCommand="delete from table1 where tid=@tid"
UpdateCommand="update table1 set name=@name where tid=@tid ">
<UpdateParameters>
<asp:Parameter Name="name" Type="String"/>
<asp:Parameter Name="tid" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
删除有效,但更新无效...单击编辑按钮,然后单击保存按钮,输入文本,它仅传递旧值.什么问题,请任何人帮助我...
感谢批次...
The Delete is working put the Update is not working... I click Edit button then enter the text after i click save button it is pass the old value only..What is the problem please any one help me...
Thank''s Lot...
推荐答案
ConnectionStrings:ConnectionString%>" SelectCommand =" 从表1中选择提示,团队,名称" span> DeleteCommand =" 从table1中删除,其中tid = @ tid" span> UpdateCommand =" 更新table1设置name = @ name,其中tid = @ tid" < UpdateParameters > < asp:Parameter 名称 =" 类型 字符串" > < asp:Parameter 名称 =" 类型 Int32 " / < /UpdateParameters > < /asp:SqlDataSource >
ConnectionStrings:ConnectionString %>" SelectCommand="SELECT tid,team,name from table1" DeleteCommand="delete from table1 where tid=@tid" UpdateCommand="update table1 set name=@name where tid=@tid "> <UpdateParameters> <asp:Parameter Name="name" Type="String"/> <asp:Parameter Name="tid" Type="Int32" /> </UpdateParameters> </asp:SqlDataSource>
删除有效,但更新无效...单击编辑按钮,然后单击保存按钮,输入文本,它仅传递旧值.什么问题,请任何人帮助我...
谢谢手...
The Delete is working put the Update is not working... I click Edit button then enter the text after i click save button it is pass the old value only..What is the problem please any one help me...
Thank''s Lot...
我有同样的问题.
尝试将AllowAutomaticUpdates ="True"(以及所有其他AllowAutomatic)放入MasterTableView标记中.
Hi,
I had the same kind of problem.
Try to put the AllowAutomaticUpdates="True" (and all the others AllowAutomatic) in the MasterTableView tag.
<telerik:RadGrid ID="YourGrid" runat="server" AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" CellSpacing="0" DataSourceID="YourEDSDataSource" GridLines="None" >
<ClientSettings>
<Selecting CellSelectionMode="None"></Selecting>
</ClientSettings>
<MasterTableView AutoGenerateColumns="False" DataKeyNames="Id" DataSourceID="YourEDSDataSource" EditMode="InPlace" AllowAutomaticUpdates="true" AllowAutomaticInserts="true" AllowAutomaticDeletes="true">
(...)
希望对您有所帮助,
问候
Raph
Hope it helps,
Regards
Raph
这篇关于在C#中的asp.net中的Telerik RadGrid中的自动更新问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!