Sunday, March 11, 2012

Ajax slider in Gridview?

This should work. What's breaking for you?

David,

I have an access database with an xyz table. All of the database variables are number long integer type, except for id which is autonumber. The database contains three rows of data, all rows are the same: x=1; y=2; z=3. The gridview populates with the table data when I run the code. However, the slider bar does not show up. Instead, I get two textbox fields in the template column, the texbox with ID="textbox_target" populates with the value for z. On the lower left hand corner of the browser I get an error message(yellow exclamation point on a white page). I click it and it displays the following error message:

Line: 197
Char: 25
Error: Object doesn't support this property or method.
Code: 0
URL:http://localhost...

I am using VS2005 & Ajax(1,717KB zip) control toolkit. I have tried this code with IE6 & IE7 with the same result.

Any help would be appreciated, thanks.

-Robert

My declarative code:

<%

@.PageLanguage="VB"AutoEventWireup="true"CodeFile="Default.aspx.vb"Inherits="_Default" %>

<%

@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<

htmlxmlns="http://www.w3.org/1999/xhtml">

<

headrunat="server"><title>Untitled Page</title>

</

head>

<

body><formid="form1"runat="server"> <asp:ScriptManagerID="ScriptManager1"runat="server"></asp:ScriptManager><div><asp:GridViewID="GridView1"runat="server"AutoGenerateColumns="False"DataKeyNames="id"DataSourceID="AccessDataSource1"Style="position: relative; left: 6px; top: 5px;"Width="447px"><Columns><asp:BoundFieldDataField="id"HeaderText="id"InsertVisible="False"ReadOnly="True"SortExpression="id"/><asp:BoundFieldDataField="x"HeaderText="x"SortExpression="x"/><asp:BoundFieldDataField="y"HeaderText="y"SortExpression="y"/><asp:BoundFieldDataField="z"HeaderText="z"SortExpression="z"/><asp:TemplateField><ItemTemplate><asp:TextBoxID="textbox_bound"runat="server" Style="position: relative"></asp:TextBox><asp:TextBoxID="textbox_target"Text='<%#Container.DataItem("z") %>'runat="server"></asp:TextBox><br/><cc1:SliderExtenderID="SliderExtender1"Minimum="-100"Maximum="100"steps="5"TargetControlID="textbox_target"BoundControlID="textbox_bound"runat="server"></cc1:SliderExtender></ItemTemplate></asp:TemplateField>

</Columns></asp:GridView></div><asp:AccessDataSourceID="AccessDataSource1"runat="server"DataFile="~/App_Data/xyztable.mdb"SelectCommand="SELECT * FROM [xyztable]"></asp:AccessDataSource></form>

</

body>

</

html>

My code behind:

PartialClass _Default

Inherits System.Web.UI.Page

ProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.Load

EndSub

EndClass


Hi,

thanks for reporting this, I'm able to reproduce it. However, the issue seems to be fixed in the latest development release. Do you minddownloading it and trying with the new code? In the meanwhile I'll continue to investigate the issue.


Garbin,

I downloaded the lastest code and it works. Thanks!!

I am curious as to why you can set the target textbox in slider properties panel, but not the bound control? You have to specify the bound control in the code. Is there a reason for this?

Thanks,

-Robert

No comments:

Post a Comment