Web Forms :: Removing / Adding Sidebar Links Dynamically

Feb 2, 2010

I am using Wizard control, my requirement is when drop down list selected index change event occurs , based on the selected item I should remove or disable some side bar links. I have seen many posts removing and adding dynamically. But I could able to remove dynamically but I could not able to add dynamically. I am getting Viewstate problem.

View 1 Replies


Similar Messages:

Adding And Removing Items Dynamically In One View With Entity Framework And MVC

Mar 1, 2011

I've been at this same question in different forms now for a while (see e.g. Entity Framework and MVC 3: The relationship could not be changed because one or more of the foreign-key properties is non-nullable. ), and it's still bugging me, so I thought I'd put it a little more generically:

You have an entity object (using Entity Framework), say User. The User has some simple properties such as FirstName, LastName, etc. But it also has some object property lists, take the proverbial example Emails, to make this simple. Email is often designed as a list of objects so that you can add to that object properties like Address and Type (Home, Work, etc). I'm using this as an example to keep it generic, but it could be anything, the point is, you want the user to be able to add an arbitrary number of these items. You should also be able to delete items (old address, or whatever).

Now, in a normal web page you would expect to be able to add these items in the same View. But MVC as it seems designed only makes it easy to do this if you call up an entirely new View just to add the address. (In the template for an Index View you get the "Create New" link e.g.).

I've come across a couple of examples that do something close to what I mean here:

[URL]

and

[URL]

The problem is, although the sample projects on these sites work fine, with mock model objects, and simply lists (not an object with a child list), it's a different thing if you actually want to do something with the posted information - in my case save to database through the Entity Framework model. To adapt these cases to that, all of a sudden I'm in a maze of intricate and definitely not DRY code... Juggling objects with AutoMapper and whatnot, and the Entity Framework won't let you save and so on (see above link if you're interested in the details).

What I want to get at is, is it really possible that this is such an uncommon thing to want to do? Update a child collection in the same View as the parent object (such as the email addresses in this case)? It seems to me it can't be uncommon at all, and there must be a standard way of handling this sort of scenario, and I'm just missing it (and no one here so far has been able to point me to a straighforward solution, perhaps because I made it too abstract with my own application examples).

View 1 Replies

Put 4 Links In The Sidebar Of Master Page Which Every Other Form (content Page) In Web Application Inherits - C# / Visual Studio 2008

Apr 3, 2011

I want to have 4 links in the sidebar of master page which every other form (content page) in my web application inherits.

<table>
<tr>
<td width= "150px">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
<asp:Menu runat="server" ID="MainMenu1" CssClass="MasterContent" StaticSubMenuIndent="30px">
<Items>
<asp:MenuItem Text="My Software" NavigateUrl="~/MySoftware.aspx"></asp:MenuItem>
<asp:MenuItem Text="Check Out" NavigateUrl="~/CheckOut.aspx"></asp:MenuItem>
<asp:MenuItem Text="View Shopping Cart" NavigateUrl="~/ShoppingCart.aspx"></asp:MenuItem>
<asp:MenuItem Text="Continue Shopping" NavigateUrl="~/Start.aspx"></asp:MenuItem>
</Items>
</asp:Menu>
</asp:ContentPlaceHolder>
</td>
<td width="900px">
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
</table>

This is the content in the master page as you can see there are 4 menu items i tried to form as sidebar and i tried to inherit in home.aspx(one of the content pages) as follows:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Start.aspx.cs" Inherits="WebStore._Start"
MasterPageFile="~/Webstore.Master" %>
<asp:Content ID="StartSideBar" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">

But unfortunately the sidebar is not at all getting displayed. I know i'm doing fundamentally wrong some where. My intention is to have web pages to have sidebar like this. It is a screenshot of my intended page.

View 1 Replies

Web Forms :: Removing Links When Exporting To Excel

Jan 20, 2012

URL...I now want to turn off all hyperlinks that are in the gridview.  How do I do that with this code?

 Button on page<asp:Button ID="Button2" runat="server" Text="Export to Excel"
OnClick="BtnExportExcel_Click" Font-Names="Arial" style="text-align: center" />
Code behind: Public Overloads Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
' Verifies that the control is rendered
End Sub
otected Sub BtnExportExcel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click

[code]....

View 1 Replies

Web Forms :: Adding Or Removing A SiteMapNode To A Menu Control At Runtime?

May 27, 2010

I need to have a siteMapeNode for a menu control to only show up during development.

The following node would be in the web.sitemap file.

[Code]....

I can either put this node in my web.sitemap file and remove it in release builds.

Or Add the node in debug builds.

Probably done in PreInit or Page_load events.

View 2 Replies

Forms Data Controls :: GridView: Adding Links To EmptyDataTemplate?

Aug 17, 2010

I have a grid view (using sqldatasource & C#) which returns no rows. By design asp.net does not show header/footer. I looked at couple of sites and suggestions and found it to be too complex. Nothing was simple. The one I found was to create a empty datatable, insert rows and bind it to the gridview. But that code does notwork for me because I am using sqldatasource and using datatable gives error.I decided to just add the following to empty item template.

<EmptyDataTemplate>

<div>
<asp:Label Text="No details found." runat="server"> </asp:Label>[code]....

THe link shows up in the bottom but the event gridview_RowCommand is not fired as the grid view is not created or it does not have rows

How do I call a function on click the add new link and put all my code in there to insert possibly using a modal popup. I cannot use onclientclick because it is javascript.

View 8 Replies

Web Forms :: Removing The Border Style For Dynamically Created Image Controls?

May 21, 2010

sometimes we need to use the asp image control so we can generate empty alt tags (visual studio 2005 does not render any attributes set
to an empty string). I know how to do this and also how to remove the border style that is automatically added

(http://blog.josh420.com/archives/2007/10/aspnet-image-control-border-width-inline-style.aspx).

We implemented this 6 months ago, however, only today have I discovered that it does not work when images are created dynamically.The first implementation was for asp images that have been set up within an aspx page:

-<asp:image runat="server" id="imgMast1" GenerateEmptyAlternateText="True" alternatetext="" imageurl="" />

The above works-no border style is rendered and the imageurl is populated in code.I have other pages where I'm building up sections dynamically using C# code, such as:-

System.Web.UI.WebControls.Image featureImage = new
System.Web.UI.WebControls.Image();
featureImage.GenerateEmptyAlternateText = true;
featureImage.ImageUrl = imageSrc;
divImage1.Controls.Add(featureImage);
divImageFeature.Controls.Add(divImage1);

When creating controls dynamically like this, the solution describe above does not remove the border style.

View 8 Replies

Adding And Removing XML Namespaces And Nodes

Jan 30, 2013

I am using vs2008 vb code behind. I am currently receiving an object through a web service that I serialize into xml. What I'd like to do after that is remove the namespaces, and add nodes to sort of customize my own xml doc. I am getting an error on this

Code:
Dim DOC1 As New XmlDocument
Dim STR As String
STR = ConvertObjectToXmlString(HODRes).ToString
DOC1.LoadXml(STR)

[Code] ....

The error I get is:

Server Error in '/RateAudit' Application.
________________________________
Data at the root level is invalid. Line 1, position 1.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.

Source Error:

Line 109: Dim STR As String
Line 110: STR = ConvertObjectToXmlString(HODRes).ToString
Line 111: DOC1.LoadXml(STR)
Line 112:
Line 113:

View 1 Replies

Is There Any Way To Stop A Check Out From Adding/removing File

Oct 19, 2010

I have an AJAX-heavy ASP.NET web application developed using .NET 4.0, using TFS as our source control. We recently upgraded our dev tools to use VS2010 and TFS 2010 exclusively, but now every time a file is checked out, we see visual studio reloading all the symbols, and all the sessions being dropped.

After putting some error logging code, we discovered the reason for the recycle is it reckons App_offline.htm is changing whenever we check out. This doesn't exist anywhere in the project, and my SO-fu has found some information about SQL Express making this file get created and deleted, so it's possible that's what's happening here.

It looks like I do have SQL-Express installed, but even disabling the services that are running, the problem persists.

Is there any way to stop a check out from adding/removing this file, if this is indeed what is happening? It's beyond frustrating to have the app recycle whenever I simply check out a file...

View 3 Replies

ADO.NET :: Adding Or Removing Result Columns From Edmx File?

Nov 29, 2010

I have a stroed procedure which is mapped in myEDMX file under EntityContainer >>Function Imports. When I add or remove a column from the stored procedure, I am not able to remove the old columns from the model. I right click on the stored procedure in Model browser and got to Edit Function Import. The return type is complex.

I select "get column information" and get the updated return fields but can not update the collection. It will work if I click on "Create New Complex Type" but it will generate a new name for the collection and the old collection is still in the mode. I even tried deleting and adding the stored procedures and can not get it to work. I can only edit the edmx.cs and the XML to remove it but there is got to be a better way.

View 3 Replies

Forms Data Controls :: GridView Links Dynamically DataBind ()

Dec 22, 2010

I've this table Table1(ID , LinkURL , LinkText )

I would like LinkText to display as a link. And when you click it takes the value from LinkURL and directs you to another page.

This is the code:

<asp:GridView id="GridView1" runat="server"></asp:GridView>
And this is the code-behind:

connection.Open()

Dim reader As SqlDataReader = cmd.ExecuteReader() [code]....

View 5 Replies

MVC :: Adding Links In TextArea

Apr 10, 2010

How to add links in a TextArea using MVC? This one doesn't look good. [:(]

<%=Html.TextArea("textarea_name", "<a href=""/link_1/"">Text 1</a>", "<a href=""/link_2/"">Text 2</a>")%>

View 8 Replies

Adding / Removing Session Variables On Page OnInit/OnLoad In C#?

Jan 16, 2011

I am using C#.

I am having below code in C#:

protected override void OnInit(EventArgs e)
{
try
{
if (Session["boolSignOn"].ToString() == "true".ToString())
{
lblPanelOpen.Text = Session["panelOpen"].ToString();
}
else
{
lblPanelOpen.Text = Session["panelOpen"].ToString();
}
}
catch (Exception ex)
{
Logger.Error("Error processing request:" + ex.Message);
}
}
protected override void OnLoad(EventArgs e)
{
try
{
if (!string.IsNullOrEmpty(Session["panelOpen"].ToString()))
{
lblPanelOpen.Text = string.Empty;
Session.Remove("panelOpen");
}
}
catch (Exception ex)
{
Logger.Error("Unable to remove the session variable:" + ex.Message);
}
}

In above code I am having a Session["panelOpen"] variable which is created from another user control and once my page is trying to render, I am storing Session["panelOpen"] in my hidden lblPanelOpen.Text on page OnInit() method, however when page is loaded completely then I am trying to remove the session variable.

View 4 Replies

Removing A Row From Gridview Dynamically At Runtime?

Mar 17, 2011

I have created a gridview which adds a remove button through item template. I wish to know how do u remove the row from grid view dynamically depending upon the button he clicks ?

protected void RemoveBtn_OnClick(object sender, EventArgs e)
{
Button clickedButton = sender as Button;
GridViewRow row = (GridViewRow)clickedButton.Parent.Parent;
int rowID = Convert.ToInt16(row.RowIndex);
GridView1.DeleteRow(rowID);
}
[code]...

View 1 Replies

Adding Dynamic Links Using NavigateURL?

Jun 16, 2010

I Have this code in my page, and I want that every NavigateUrl display another page like : simple.aspx? id=1, simple.aspx?id=2, ...

Where id = c
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim c As Integer = 0
While c < 5
Dim Label1 As New Label()
Dim ltr As New Literal()
Dim link As New HyperLink()
link.NavigateUrl = "simple.aspx"
link.BackColor = Drawing.Color.Aqua
Label1.Text = c.ToString()
ltr.Text = "<br/>"
PlaceHolder1.Controls.Add(Label1)
PlaceHolder1.Controls.Add(link)
PlaceHolder1.Controls.Add(ltr)
c += 1
End While
End Sub

View 1 Replies

VS 2010 - Adding Links To GridView

Sep 16, 2011

I'm populating a GridView with data from an Excel sheet. I'm using some code from MSDN that grabs the data via a range.

VB.NET Code:

Public Sub GetExcelData(ByVal gv As GridView, ByVal path As String)       
' Define variables and default values       
Dim i As Integer = 0        Dim j As Integer = 0        
' Create connection string variable.       
Dim strConnection As String = "Provider=Microsoft.ACE.OLEDB.12.0;" _ 

[Code] ....

Which works great. I have different areas of the intranet where I'm using this. The first page only needs to read the plain data from the Excel sheet. But, now I'm trying to read the data, but also keep the links that are within the sheet.

The data that is populate basically looks like this:

#1 Name Link1 Link2
#2 Name Link1 Link2
#3 Name Link1 Link2

But the links aren't kept. So, how I can accomplish this.

There might be an easier way, but this is what I was thinking. The links correspond to PDFs on the server. When the data loads, I could loop through the list and dynamically change each "link" cell to a hyperlink. The problem is matching up the link to the PDFs. The name of the PDFs aren't exactly the same as the name in the cell. So I'd have to create another table or something, that could reference that data. A Select Case would work, but that's super time consuming and I have to make this as seamless to update as possible.

So I'm not sure I want to do that. If I could just maintain the links as the data has bound, that'd be awesome. But I have a feeling that won't be possible. My searches are coming up short so far.

View 4 Replies

Forms Data Controls :: Gridview With Links / How To Dynamically Add Linkbutton Columns From Code Behind

Jan 26, 2010

I have been searching for some time on the net for guidance on this question. Finally thought I will ask here...

I have a gridview that needs to be generated from code behind. There is a column with a name field and the remaining columns give the different user-ids linked to that id. Like this:

-- NAME, ID1, ID2, ID3......

The Name column will be populated from a table that has the Name as well as number of ID's associated with that name. eg [Name1][3]

I need to display linkbuttons that link to user-id related documents in columns 2 to n for each name.How do I dynamically add linkbutton columns from code behind?

View 3 Replies

Web Forms :: How To Put The Wizard Control Sidebar In The Right Side

Jan 18, 2010

by default when u put the DisplaySideBar=true it automatically go to the left side, how can i put the sidebar to the right side?

View 2 Replies

Web Forms :: Wizard Control - Disable Validation When Sidebar Is Clicked

Dec 17, 2010

Does anyone know of a way to disable validation for a step when a sidebar link is clicked?

I know there is a 'CausesValidation' property for linkbutton, but how would one apply it to the siderbar items?

View 1 Replies

Build Images Links Dynamically

Apr 6, 2010

I am developing a website that has product images on an external server. I have code that tests to see if the image exists like (pseudo code):

DynamicString = FunctionThatCreatesDynamicString()
' DynamicString = "[URL]
If ImageExists(DyanmicString) = StatusCode.200 Then
' Embed link in ASP.NET page
Else
' Embed not found image in ASP.NET page
End If

My code builds fine and appears to execute. The problem occurs when I attempt to view the external link in a browser, the image appears properly (I have to authenticate first, but that's OK considering I'm on an internal network and this app will be used internally). However, when I attempt the view the source in my generated HTML page, I am seeing the image to the "Not Found" image when I know the image is there. I compared all the characters in my dynamically assembled to the external link and all the characters are matching up correctly. I'm wondering if the authentication has anything to do with why the image is not rendering properly on my rendered HTML.

View 1 Replies

Forms Data Controls :: Selecting Specific Data And Adding Links?

Jun 14, 2010

I'm trying to access and display certain data in my database using category ID's. I've added values to the links in a link list and I was to have the selected value as the one that determines the selection in the selection statement. For example, "SELECT [ID_key] AS ID_Key, [Title], [Source], [PublicationDate], [Url], [CatID] FROM [Newsarts] WHERE ([CatID] = Linklist1.SelectedValue)". I know Linklist1.SelectedValue doesn't work or it may work and I don't know how but I want to be able to use the value selected from the previous link. Is there a way?

Also, after all the data is displayed, I would like them to become links themselves. Basically, I want to choose a category, then choose an article in that category, and they hit the link to display the article's content.

View 2 Replies

AJAX Download Manager / Bunch Of Dynamically Generated Links To Zip File?

Jan 25, 2011

I currently have an asp.net page which a loggd in user goes to and theres a bunch of dynamically generated links to zip files that he or she owns and can downloads.Currently they click download and I have no way of knowing if it completes succesfully etc so can't log it. I do log the attempt.Is there are good download manager or solution I can use so they will have progress bars on the site, they can queue multiple ones up and most importantly I can track failed and successful downloads.

View 1 Replies

Configuration :: Removing Login Account Without Removing User?

May 31, 2010

Long ago, I created an ASPNET user for development use.However, every time I boot up my dev system, I'm presented with a user login for ASPNET, among others.I don't want to remove ASPNET; I need it for dev work.But how do I keep it from appearing among the list of User Logins available at boot-up?

View 4 Replies

Master Page Sidebar Display After Login?

Dec 12, 2010

I have the following sidebar on my master page. It is not a part of any ContentPlaceHolder.

<div runat="server" visible="false" id="menuAccountMembersDiv" class="leftCol">
<asp:Menu ID="menuAccountMembers" runat="server" StaticSubMenuIndent="16px" Visible="false">
<Items>
<asp:MenuItem ImageUrl="~/Resources/x.png"

[Code]....

View 3 Replies

Web Forms :: Dynamically Adding A Css Class?

Nov 18, 2010

I have a website built that uses master page templates. In the master page I have a simple menu in a list. This is not dynamic (yet!).

I am trying to put together some code behind to write a simple css class to one of the menu links if the Request.ServerVariables("URL") is equal to the current page URL

I have no code written because everything complains when I try to come up with something. I was thinking of doing it using a switch function but am I over complicating things?Below is the simple menu with the class I am trying to write to the link:

<div id="nav">
<ul>
<li><a class="selected" href="Default.aspx" title=""></li>
<li><a href="" title="ThisPage.aspx"></li> [code]....

View 14 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved