Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Datagrid - can that be refreshed via client side javascript?

Reply
Thread Tools

Datagrid - can that be refreshed via client side javascript?

 
 
James Radke
Guest
Posts: n/a
 
      11-11-2003
Hello,

Through this forum I have found out that you can refresh most web page
controls via javascript.

That made me wonder if there is a way to refresh (.i.e. rebind) a bound
datagrid via combination of webservice calls and javascript functions so
that a complete page roundtrip is not necessary to refresh only a datagrid
within the page.

Does anyone know if this is possible, and if so, how one could go about
doing it?

Thanks!

Jim


 
Reply With Quote
 
 
 
 
Jacob Yang [MSFT]
Guest
Posts: n/a
 
      11-13-2003
Hi James,

Thank you for posting to the MSDN newsgroups.

I am interested in this issue and researching it now. More time is needed.
I will update you as soon as possible.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ĘC www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

 
Reply With Quote
 
 
 
 
James Radke
Guest
Posts: n/a
 
      11-13-2003
Jacob,

Thanks! Let me know what you find out..... If there was a way to do that,
it would be very nice.....

Jim

"Jacob Yang [MSFT]" <(E-Mail Removed)> wrote in message
news:k$(E-Mail Removed)...
> Hi James,
>
> Thank you for posting to the MSDN newsgroups.
>
> I am interested in this issue and researching it now. More time is needed.
> I will update you as soon as possible.
>
> Best regards,
>
> Jacob Yang
> Microsoft Online Partner Support
> Get Secure! ĘC www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
>



 
Reply With Quote
 
Jacob Yang [MSFT]
Guest
Posts: n/a
 
      11-14-2003
Hi James,

I have done a lot of research regarding this issue. Based on my research
and experience, I don't think that we can refresh/rebind the datagrid web
control via the client script.

The reason is that the datagrid web control is a server side control. In
the client side, what we get is a HTML table. Please test the following
simple sample on your side.
----------------------------------------------------------------------------
------------
<%@ Page Language="VB" AutoEventWireup="True" %>
<%@ Import Namespace="System.Data" %>

<html>
<script language="VB" runat="server">
Function CreateDataSource() As ICollection
Dim dt As New DataTable()
Dim dr As DataRow

dt.Columns.Add(New DataColumn("IntegerValue", GetType(Int32)))
dt.Columns.Add(New DataColumn("StringValue", GetType(String)))
dt.Columns.Add(New DataColumn("CurrencyValue", GetType(Double)))

Dim i As Integer
For i = 0 To 8
dr = dt.NewRow()

dr(0) = i
dr(1) = "Item " + i.ToString()
dr(2) = 1.23 *(i + 1)

dt.Rows.Add(dr)
Next i

Dim dv As New DataView(dt)
Return dv
End Function 'CreateDataSource


Sub Page_Load(sender As Object, e As EventArgs)

If Not IsPostBack Then
' Load this data only once.
ItemsGrid.DataSource = CreateDataSource()
ItemsGrid.DataBind()
End If
End Sub 'Page_Load

</script>

<body>

<form runat=server>

<h3>DataGrid Example</h3>

<b>Product List</b>

<aspataGrid id="ItemsGrid"
BorderColor="black"
BorderWidth="1"
CellPadding="3"
AutoGenerateColumns="true"
runat="server">

<HeaderStyle BackColor="#00aaaa">
</HeaderStyle>

</aspataGrid>

</form>

</body>
</html>
---------------------------------------------------------------------

On the client side, please access the above web page and select
IE->View->Source. We can see the following HTML code.
-------------------------------------------------------
...
<table cellspacing="0" cellpadding="3" rules="all" bordercolor="Black"
border="1" id="ItemsGrid"
style="border-color:Black;border-width:1px;border-style:solid;border-collaps
e:collapse;">
<tr style="background-color:#00AAAA;">
<td>IntegerValue</td><td>StringValue</td><td>CurrencyValue</td>
</tr><tr>
<td>0</td><td>Item 0</td><td>1.23</td>
</tr><tr>
<td>1</td><td>Item 1</td><td>2.46</td>
</tr><tr>
<td>2</td><td>Item 2</td><td>3.69</td>
</tr><tr>
<td>3</td><td>Item 3</td><td>4.92</td>
</tr><tr>
<td>4</td><td>Item 4</td><td>6.15</td>
</tr><tr>
<td>5</td><td>Item 5</td><td>7.38</td>
</tr><tr>
<td>6</td><td>Item 6</td><td>8.61</td>
</tr><tr>
<td>7</td><td>Item 7</td><td>9.84</td>
</tr><tr>
<td>8</td><td>Item 8</td><td>11.07</td>
</tr>
</table>
...
---------------------------------------------------------------

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ĘC www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

 
Reply With Quote
 
James Radke
Guest
Posts: n/a
 
      11-14-2003
Jacob,

Thats what I thought, but I was hoping there was something I missed!

Thanks for looking into it in detail though!

Jim

"Jacob Yang [MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi James,
>
> I have done a lot of research regarding this issue. Based on my research
> and experience, I don't think that we can refresh/rebind the datagrid web
> control via the client script.
>
> The reason is that the datagrid web control is a server side control. In
> the client side, what we get is a HTML table. Please test the following
> simple sample on your side.
> --------------------------------------------------------------------------

--
> ------------
> <%@ Page Language="VB" AutoEventWireup="True" %>
> <%@ Import Namespace="System.Data" %>
>
> <html>
> <script language="VB" runat="server">
> Function CreateDataSource() As ICollection
> Dim dt As New DataTable()
> Dim dr As DataRow
>
> dt.Columns.Add(New DataColumn("IntegerValue", GetType(Int32)))
> dt.Columns.Add(New DataColumn("StringValue", GetType(String)))
> dt.Columns.Add(New DataColumn("CurrencyValue", GetType(Double)))
>
> Dim i As Integer
> For i = 0 To 8
> dr = dt.NewRow()
>
> dr(0) = i
> dr(1) = "Item " + i.ToString()
> dr(2) = 1.23 *(i + 1)
>
> dt.Rows.Add(dr)
> Next i
>
> Dim dv As New DataView(dt)
> Return dv
> End Function 'CreateDataSource
>
>
> Sub Page_Load(sender As Object, e As EventArgs)
>
> If Not IsPostBack Then
> ' Load this data only once.
> ItemsGrid.DataSource = CreateDataSource()
> ItemsGrid.DataBind()
> End If
> End Sub 'Page_Load
>
> </script>
>
> <body>
>
> <form runat=server>
>
> <h3>DataGrid Example</h3>
>
> <b>Product List</b>
>
> <aspataGrid id="ItemsGrid"
> BorderColor="black"
> BorderWidth="1"
> CellPadding="3"
> AutoGenerateColumns="true"
> runat="server">
>
> <HeaderStyle BackColor="#00aaaa">
> </HeaderStyle>
>
> </aspataGrid>
>
> </form>
>
> </body>
> </html>
> ---------------------------------------------------------------------
>
> On the client side, please access the above web page and select
> IE->View->Source. We can see the following HTML code.
> -------------------------------------------------------
> ..
> <table cellspacing="0" cellpadding="3" rules="all" bordercolor="Black"
> border="1" id="ItemsGrid"
>

style="border-color:Black;border-width:1px;border-style:solid;border-collaps
> e:collapse;">
> <tr style="background-color:#00AAAA;">
> <td>IntegerValue</td><td>StringValue</td><td>CurrencyValue</td>
> </tr><tr>
> <td>0</td><td>Item 0</td><td>1.23</td>
> </tr><tr>
> <td>1</td><td>Item 1</td><td>2.46</td>
> </tr><tr>
> <td>2</td><td>Item 2</td><td>3.69</td>
> </tr><tr>
> <td>3</td><td>Item 3</td><td>4.92</td>
> </tr><tr>
> <td>4</td><td>Item 4</td><td>6.15</td>
> </tr><tr>
> <td>5</td><td>Item 5</td><td>7.38</td>
> </tr><tr>
> <td>6</td><td>Item 6</td><td>8.61</td>
> </tr><tr>
> <td>7</td><td>Item 7</td><td>9.84</td>
> </tr><tr>
> <td>8</td><td>Item 8</td><td>11.07</td>
> </tr>
> </table>
> ..
> ---------------------------------------------------------------
>
> If I have misunderstood your concern, please feel free to let me know.
>
> Best regards,
>
> Jacob Yang
> Microsoft Online Partner Support
> Get Secure! ĘC www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
How to execute client-side code _after_ client-side validation? Bogdan ASP .Net 2 06-09-2008 01:31 PM
Client side script after client side validation with asp.net 2.0 Boss302 ASP .Net 0 11-21-2006 08:43 AM
get image side via client side script before file uplaod moondaddy ASP .Net 2 07-16-2004 04:50 AM
Adding custom client-side onClick handler with client-side validator controls Zoe Hart ASP .Net Web Controls 1 01-08-2004 10:45 PM



Advertisments