PDA

View Full Version : [CLOSED] Store c# DataBind() Method in v3.2 problem



siyahgul
Aug 30, 2015, 11:44 PM
hi.

souce code


<ext:ResourceManager runat="server" ShowWarningOnAjaxFailure="false" />

<asp:SqlDataSource ID="sds1" runat="server" ConnectionString="<%$ ConnectionStrings:Con_Test %>"
SelectCommand="SELECT id, col1, col2">
</asp:SqlDataSource>

<ext:Store runat="server" ID="store1" DataSourceID="sds1">
<Model>
<ext:Model runat="server" IDProperty="id">
<Fields>
<ext:ModelField Name="id" Type="Int" />
<ext:ModelField Name="col1" Type="String" />
<ext:ModelField Name="col2" Type="String" />
</Fields>
</ext:Model>
</Model>
</ext:Store>

<ext:GridPanel ID="grid1" StoreID="store1" runat="server">
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" Text="id" DataIndex="id" Width="55" />
<ext:Column runat="server" Text="col1" DataIndex="col1" Flex="1" />
<ext:Column runat="server" Text="col2" DataIndex="col2" Flex="1" />
</Columns>
</ColumnModel>
</ext:GridPanel>

<ext:Button runat="server" Text="Load">
<Listeners>
<Click Handler="var store = App.store1; App.direct.Store_Load([store.storeId], { eventMask: { showMask: true, msg: 'wait' } });" />
</Listeners>
</ext:Button>


cs code


[DirectMethod]
public void Store_Load(string[] comList)
{
foreach (var item in comList)
{
try
{
Store com = this.Page.FindControl(item.ToString()) as Store;

com.DataBind();
}
catch (Exception)
{

}
}
}


The first step: when the page is opened records loaded.
The second step: I'm adding records to the database manually.
The third step: I click the load button.

I added manually does not come on record.
I added in version 3.0 came on record with manually.
Did changes in version 3.2?

Daniil
Aug 31, 2015, 2:38 PM
Hi @siyahgul,

I cannot reproduce. For the sake of testing I replaced SqlDataSource with ObjectDataSource.

Example

<%@ Page Language="C#" %>

<script runat="server">
[DirectMethod]
public void Store_Load(string[] comList)
{
foreach (var item in comList)
{
try
{
Store com = this.Page.FindControl(item.ToString()) as Store;

com.DataBind();
}
catch (Exception)
{
}
}
}
</script>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Ext.NET v3 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />

<asp:ObjectDataSource
ID="ObjectDataSource1"
runat="server"
TypeName="Test"
SelectMethod="GetTestData" />

<ext:Button runat="server" Text="Load">
<Listeners>
<Click Handler="App.direct.Store_Load([ App.Store1.storeId ], { eventMask: { showMask: true, msg: 'wait' } });" />
</Listeners>
</ext:Button>

<ext:GridPanel runat="server">
<Store>
<ext:Store ID="Store1" runat="server" DataSourceID="ObjectDataSource1">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="test1" />
<ext:ModelField Name="test2" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" Text="Test 1" DataIndex="test1" Width="150" />
<ext:Column runat="server" Text="Test 2" DataIndex="test2" Width="150" />
</Columns>
</ColumnModel>
</ext:GridPanel>
</form>
</body>
</html>


Test.cs

public class Test
{
public object[] GetTestData()
{
var ticks = System.DateTime.Now.Ticks;

return
new object[]
{
new object[] { ticks, ticks },
new object[] { ticks, ticks }
};
}
}

The test case doesn't add new data, but it tests a store.DataBind() call inside a DirectMethod which appears to be working. In this aspect there is no difference in Ext.NET logic for SqlDataSource and ObjectDataSource.


The third step: I click the load button.

Please clarify what does happen after that? Is Store_Load DirectMethod being executed? What is a response?

siyahgul
Sep 02, 2015, 12:12 AM
hi Daniil.

You have this code, you'll be testing, or you will not. I'm having this problem right now. "DataBind ()" method works when the database manually entered records do not come. "js" side "store.load ();" I also do not come.

good working.

Daniil
Sep 02, 2015, 12:57 AM
I am afraid we don't have access to a database that you are dealing with and I am not sure it is going to be reproducible with any database.

There is a good chance that answers to my questions (from my previous post) could clarify the situation and lead to some guesses what is going on.

siyahgul
Sep 02, 2015, 1:03 AM
hi Daniil.

you can use my database in Tomorrow. but I have to send you a private message.

good working brother.

geoffrey.mcgill
Sep 02, 2015, 4:53 AM
Hello,

Please do not send you database to us. I you do, we will delete the message or email

Please review the Forum Guidelines before proceeding, see

http://forums.ext.net/showthread.php?10205-More-Information-Required

All code samples required to reproduce the problem must be posted in the forums between [CODE] tags.

siyahgul
Sep 03, 2015, 12:11 AM
hi Daniil.

problem solved. "web.config" file that you need to add the following code



<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Ext.Net.Utilities" publicKeyToken="2c34ac34702a3c23" />
<bindingRedirect oldVersion="0.0.0.0-2.5.0" newVersion="2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Transformer.NET" publicKeyToken="e274d618e7c603a7" />
<bindingRedirect oldVersion="0.0.0.0-2.1.1" newVersion="2.1.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>


thank you. good working.