Categories | Question details Back To List | ||
Problem with ColumnIDs when loading Header XML - Column IDS I noticed that when I create and load the grid completly from XMLthe param names are defaulted to null in the request object eg in the get.asmx page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Response.Clear() Response.ContentType = "text/xml" Response.ContentEncoding = Encoding.UTF8 Response.Write("<?xml version=""1.0"" encoding=""UTF-8""?>") Response.Write("<rows>") Response.Write(BuildHeader()) Response.Write("<row id=""1"">") Response.Write("<cell>1</cell>") Response.Write("<cell>2</cell>") Response.Write("<cell>3</cell>") Response.Write("</row>") Response.Write("</rows>") Response.End() End Sub Protected Function BuildHeader() As String Dim sb As New StringBuilder sb.Append("<head>") sb.Append("<column width='50' type='ed' align='right' color='white' sort='str'>Sales</column>") sb.Append("<column width='150' type='ed' align='left' color='#d5f1ff' sort='str'>Book Title</column>") sb.Append("<column width='100' type='ed' align='left' color='#d5f1ff' sort='str'>Author</column>") sb.Append("<settings>") sb.Append("<colwidth>px</colwidth>") sb.Append("</settings>") sb.Append("</head>") Return sb.tostring End Function After the grid has rendered and a cell is editted with auto update set to 'cell' and enableDataNames(true) the request object is as follows RawUrl "/EventReporting/update.aspx?gr_id=1&null=1&null=21&null=3" String if I set enableDataNames(false) then the request oblect is happy and has RawUrl "/EventReporting/update.aspx?gr_id=1&c0=1&c1=2&c2=13" String If I remove the <head>...</head> xml from my grid XML and set the grid up manually with enableDataNames(true) the request object is again happy RawUrl "/EventReporting/update.aspx?gr_id=1&Sale=1&Author=12&Book=3" String My Question is -- Is there a way of setting the ColumnIDs from the <head>column>....</column></head> XML clearly the column title comes from the nodeText is there a columnid attribute in the <column> tag that can be used to dynamically store the database column name - this would greatly improve the end to end connectivity of the grid to the db thanks for your reply Answer posted by Support on Jan 28, 2008 07:15 >>Is there a way of setting the ColumnIDs from the <head>column>....</column></head> XML It possible by setting id attribute of column tag sb.Append("<column width='50' id="Sales" type='ed' align='right' color='white' sort='str'>Sales</column>") sb.Append("<column width='150' id="Book" type='ed' align='left' color='#d5f1ff' sort='str'>Book Title</column>") sb.Append("<column width='100' id='Author' type='ed' align='left' color='#d5f1ff' sort='str'>Author</column>") >>clearly the column title comes from the nodeText is there a columnid attribute in the <column> It not the best approach, because sometimes column title can contain complex text, so the id attribute can be used instead. Answer posted on Jan 29, 2008 02:45 Thanks for the reply - I had actually figured it out in a flash of inspiration - it was kind of obvious when you think about it LOL |