Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP.NET (Non-Forum Related)
 Dynamically filling repeater?
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

blackinwhite
Average Member

Turkey
657 Posts

Posted - 11 December 2006 :  15:25:34  Show Profile
Dear all,

I'm doing a navigation for my personal website, it populates data from SQL and fill the repeater control below.

<asp:Repeater ID="mainNav" Runat="server">
<ItemTemplate>
<%# Eval("menuItem") %>
</ItemTemplate>
</asp:Repeater>

No problem so far.

But I wanted to go beyond this and make bold the current page I'm in by using HttpContext.Current.Items["nameFile"].ToString().
So it will be like;

- home
- blog - You're here
- pictures
- contact

Are there any way of doing this?

HuwR
Forum Admin

United Kingdom
20580 Posts

Posted - 11 December 2006 :  16:02:49  Show Profile  Visit HuwR's Homepage
not using a basic repeater,without writing some code no, you could use a gridview which has a selectedrow style or since it is for navigation why not use a sitemap and menu
Go to Top of Page

blackinwhite
Average Member

Turkey
657 Posts

Posted - 12 December 2006 :  01:44:47  Show Profile
I have a template like this;

<div class="main">
<div class="mainnav_line_off"></div>
<div class="mainnav_entry_txt">blog</div>
</div>

To produce this in sitemap, treeview or menu controls, is like impossible.

can you point me an example about gridview, or link?
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20580 Posts

Posted - 12 December 2006 :  03:56:50  Show Profile  Visit HuwR's Homepage
1) I don't remember mentioning using a treeview
2) what has using a sitemap/menu got to do with your template, and why should your template make using them impossible ?
3) Try this link
4) If you think your template had any bearing on the answer, then in future mention it when you as the question, it will save people having to piss about answering you more than once.
Go to Top of Page

blackinwhite
Average Member

Turkey
657 Posts

Posted - 12 December 2006 :  14:04:40  Show Profile
Thanks HuwR,

I did it this way, I am not sure about the performance stuff though...


    public void mainNav(int idMenu)
    {
		string strMenu = null;
        SqlConnection connection = new SqlConnection("server=SPARK\\ISO;uid=xxxxxx;pwd=xxxxx;database=ISODB");
        connection.Open();
        SqlCommand command = new SqlCommand("select module_name, module_url,module_id FROM audiWS_Menu where parent_module=0", connection);
        SqlDataReader reader = command.ExecuteReader();
        while (reader.Read())
        {
			strMenu +="<div class='main'>";
			strMenu +="<div class='mainnav_line_";
			
			if (reader.GetInt32(2) == Convert.ToInt32(idMenu))
				strMenu +="on";
			else
				strMenu +="off";

			strMenu +="'></div>";
			strMenu +="<div class='mainnav_entry_txt";
			if (reader.GetInt32(2) == Convert.ToInt32(idMenu))
				strMenu +="_on";
			strMenu +="'><a href='"+reader.GetString(1)+"'>"+reader.GetString(0)+"</a></div></div>";
        }
		
        mainNavItems.Text = strMenu;

        reader.Close();
        connection.Close();

    }
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000 Version 3.4.07