Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > GridView row update does not function View modes: 
User avatar
Member
Member
david.slavik-titio - 9/15/2011 11:54:28 AM
   
GridView row update does not function
Hello,

I've developed custom webpart for edit external database. I used LinqDataSource for connect to database and custom DataSource in web.config. When I try edit row in Grid, page is postback and edited data is actualize from db but no Update changes.

If I placed my code to separate page out from Kentico. Everything goes good...

Here is code of my webpart:


<asp:GridView ID="gridSites" runat="server" DataSourceID="dsSites" AutoGenerateColumns="false"
DataKeyNames="ID">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" />
<asp:BoundField DataField="Name" HeaderText="Name" />
<asp:BoundField DataField="UrlForReplace" HeaderText="UrlForReplace" />
<asp:TemplateField HeaderText="Provider">
<ItemTemplate>
<%# Eval("Provider.Name") %>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddProvider" runat="server" DataSourceID="dsProviders" DataValueField="ID"
DataTextField="Name">
</asp:DropDownList>
<asp:LinqDataSource ID="dsProviders" runat="server" ContextTypeName="FlinkerDataDefinitionDataContext"
EntityTypeName="" TableName="Providers">
</asp:LinqDataSource>
</EditItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="SiteParameter" HeaderText="SiteParameter" />
<asp:CheckBoxField DataField="ReplaceUrl" HeaderText="ReplaceUrl" />
<asp:CommandField ShowEditButton="True" ShowDeleteButton="true" CancelText="Zpět"
EditText="Upravit" UpdateText="Uložit" HeaderStyle-Width="150px" />
</Columns>
</asp:GridView>
<asp:LinqDataSource ID="dsSites" runat="server" ContextTypeName="FlinkerDataDefinitionDataContext"
EntityTypeName="" TableName="Sites" EnableUpdate="true">
</asp:LinqDataSource>


Please help me...
Thank you David

User avatar
Member
Member
kentico_michal - 9/16/2011 2:56:35 AM
   
RE:GridView row update does not function
Hello,

If the control works outside Kentico CMS as expected, could you please try to use User control web part to insert your own user control (ASCX) on the page instead of creating custom web part: User control web part.

All you need to specify is the virtual path to the user control in the User control virtual path property.

Best regards,
Michal Legen