Questions about DataLists

Results 1 to 3 of 3

Thread: Questions about DataLists

  1. #1
    Ryan S Guest

    Default Questions about DataLists

    I haven&#039;t had a chance to view the complete archives of messages yet, but I was curious if any of the more skilled programmers could help me out here, preferably in syntax. While I don&#039;t have sample code, the problem is very straightforward. When dealing with a DataList control, which is set to have two cells per row (RepeatDirection="Horizonal",RepeatColumns="2"), when the data source contains an uneven amount of information (ie: 7 rows), the final cell is left blank. <BR><BR>I tried this both with IE5 and Mozilla .9, and received the same information. It wrote out the appropriate code, but on that last &#060;tr&#062; it simply had one &#060;td&#062;. The problem with this is, Netscape doesn&#039;t like this very well, plus, if you&#039;ve got certain designs going, it makes things look well, to say the least, different. Is there any way (or undocumented property, as I tried to scour the docs for info) in which to compute if the data source&#039;s count modded by the repeatcolumns, and if its not zero to apply the template to blank cells? Just to replicate design?<BR><BR>In a similar question, is it possible to append cells (not using the repeater control) to a DataList without necessarily modifying the data? For example, say I have a list of product categories to be repeated in a horizontal direction, and I want to include a "Home" button? The URL of the Hyperlink is bound to the data identifier (something akin to /products.asp?ID=&#060;%ID%&#062; but style), and it would be an incredible waste of space to store the complete URL in the dataset as opposed to just the ID field. Am I making sense? I suppose I&#039;m looking for someway to add cells before/after a horizontal datalist. Any suggestions?<BR><BR>Thanks.

  2. #2
    RobT Guest

    Default RE: Questions about DataLists

    I don&#039;t know if I can help you or not but I will try.<BR>I have a DataList here with 3 column and it is working<BR><BR><BR>The solution to your second question may be possible with the "Container" which also appears in the smae example above. I think I know what you want to do. You do not want to display the entire URL. You want the ID to be the link. In other words the number "34" would be the highliughted link. You may be able to play with the container and get something done there.<BR><BR>And on a side note .NET is going to be grumpy with Netscape because of Netscape&#039;s inability to get by missing table tags. Netscpe 6 does not argue. It will display the page but Netscape 6 has its own list of bugs from the feedback I am getting.<BR><BR>Hope I helped a little :)<BR><BR>Rob<BR>

  3. #3
    Ryan S Guest

    Default RE: Questions about DataLists

    Thanks for the info rob, but a couple of things<BR><BR>In the first link you gave me, play around with your code and instead of having six rows make it five, but with three columns per row still. Hence the missing cell, hence a distorted display in IE and no display in NS.<BR><BR>Next, sorry for not addressing the problem more clearly, but I&#039;ll attempt to explain now that I&#039;ve slept. Here&#039;s some sample ASP code<BR><BR>Do while not myRS.EOF<BR> response.write "&#060;a href=""" & myRS("ID") & """&#062;" & myRS("Field") & "&#060;/a&#062;" & vbCrLf<BR> myrs.movenext<BR>Loop<BR>response.write "&#060;a href=""""&#062;No blah&#060;/a&#062;" & vbCrLf<BR><BR>Now, in that case I used it more like a repeater simply to avoid having to put more detailed code. But assume I create a cell in each iteration of that loop, and that at the end I create a new cell with a different set all together. If I use the DataList column with horizontal directions, not only do I get missing cells, but I don&#039;t have the option to "add" cells at the end, short of adding to the DataList. The problem with adding to the datalist is my database doesn&#039;t store the URL, as it is instead created programatically (via the response.write). To store the URL for each field would create much unnecessary overhead, plus make changing code a real... oh whats the phrase.. PITA :)<BR><BR>So I&#039;m looking for suggestions on someway to override the rendering in which to add cells at the beginning/end of code based on some form of property encountered by the datalist, short of creating my own custom control.<BR><BR>In case you&#039;re wondering why I&#039;m doing a datalist, it&#039;s because I don&#039;t want to just write iteration code, because that seems so much unnecessary in ASP.NET.<BR><BR>God bless,<BR> Ryan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts