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

Similar Messages:

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.


<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

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 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/>"
c += 1
End While
End Sub

View 1 Replies

VS 2010 - Hierarchy With Edit / Delete Links

Sep 28, 2011

I got a IList<Category> where a Category have an id, name and parentid. Right now I loop over all categories where the parent id is 0 (so they are root) and for each of those child categories I call a recursive function that add the child categories to the child nodes. Works fine. However, I (think) I'm going to do away with the asp:treeview since now, next to each Category I want an Edit and Delete Link.

View 3 Replies

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

Including Links To External Resources In Visual Studio 2010 Web Project

Jul 22, 2010

I have a ASP.NET project which relies upon the FreeImage .NET wrapper. This is loaded using a reference to a external directory. The wrapper relies upon the FreeImage.dll being present to work (clearly). How do I get Visual Studio to include a reference to the FreeImage dll. It's not a .NET assembly, i think it was built in something else (so I can't add it as a reference).

I don't really want to have a copy for this project as these files reside in a different SVN repository

View 2 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

VS 2010 - Adding Data From Another Webpage

Oct 31, 2012

i am developing a web application (ASP.net 2010, VB)in the sale invoice i need the user to select the item from a combobox, rate, qty and calculate the amt. there.now i have a datatable which is as below.

HTML Code:
dTableData = New DataTable
dTableData.Columns.Add(New DataColumn("Item", GetType(String)))
dTableData.Columns.Add(New DataColumn("Qty", GetType(Double)))
dTableData.Columns.Add(New DataColumn("Rate", GetType(Double)))
dTableData.Columns.Add(New DataColumn("Amount", GetType(Double)))
dTableData.Columns.Add(New DataColumn("Category", GetType(String)))
dTableData.Columns.Add(New DataColumn("CatCode", GetType(String)))
dTableData.Columns.Add(New DataColumn("ItemCode", GetType(String)))
dTableData.Columns.Add(New DataColumn("myID", GetType(Integer)))

i am using a panel to enter the data. the panel is hidden which contains the combobox and the textboxes and when the user presses add item, i unhide the panel and get the data.this is working fine. but what i was needing is (as i have seen from a webpage)when the user presses add item, a new, small, webpage opens which contains the combobox and textboxes and when the user enteres the data the same is updated to the above data and then the grid is filled with the added record.

View 3 Replies

VS 2010 - Adding A Provider To Membership

Nov 24, 2013

I am trying to use the ASP Membership database, and I am having trouble getting the provider connected. I added the following to my Web.Config.

<membership defaultProvider="SqlMembershipProvider">
<clear />

The connectionstring exists, and I am able to use it on the page to load and access a GridView control. In the Website Administration Tool, under Provider, and selecting 'Select a single provider for all site management data', I don't see any providers, indicating that this new provider is not loaded. If I remove the Clear, I do see the AspNetSqlProvider, however when I test it I get the error that it can not connect to the database.

View 3 Replies

VS 2010 - Adding Items To ListBox

Jul 12, 2011

I've never built an ASP.NET application. At my work, we have a bunch of different PDFs, Word and Excel documents, HTML pages, etc, all in one folder. My boss has tasked me with creating a web app to combine all of these items into one interface.

Among the things I'm adding, I need to convert a VB app I made. All the app does is scan our servers for log files and displays them in a ListBox.

Before I start importing the classes and setting up the code, I decided to just add a ListBox to the page and add a ListItem during page load.

VB.NET Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load    Me.lbLogs.Items.Add(New ListItem("Test", "C"))End Sub

But, an exception is thrown when I try to run it.

The example I'm using there is the example shown on MSDN. Why this is occurring?

View 13 Replies

VS 2010 - Adding Reference To Web Service

Feb 2, 2012

I have a number of .Net web sites built in VS2010 using Framework 4.0that reference a web service to send emails.

My most recent site I created as a web application as opposed to a web site. In the Solution Explorer you can add a 'Service Reference' and, if you click the Advanced button you can then add a reference to a web service.

I did that and now the (web application) site won't build - it says it cannot load the Ajax dll. If I remove the reference to the web service, the site builds okay - if I add the reference back in, the site will not build.

Do I need to abandon the idea of using a 'Web Application' and turn it into a 'Web Site'?

View 9 Replies

VS 2010 - Adding A Table With Each Datarow (3 Items Per Row)

Jan 29, 2012

I use the code below to add a table with each datarow

TableRow rowItem = new TableRow();
TableCell cellColumnInfo = new TableCell();
cellColumnInfo.VerticalAlign = VerticalAlign.Top;
cellColumnInfo.Width = 600;

[Code] ....

It works, but it only add only 1 item per row. all i want to happen is it will display the first 3 on the first row and the 2nd 3 on the second row.. and so on.. How can I do that with asp.net?

View 4 Replies

VS 2010 - Adding Datalist Control In Project

Mar 19, 2012

I add a DataList control in my asp.net project.. in the datalist, i put a image template.. it works when write the code.. The problem now is i cannot adjust the location of the image inside the datalist like its Left and Top..

View 1 Replies

Adding A Work Item To TFS 2010 From .NET App Fails Due To Permissions?

Feb 16, 2011

I'm working on an ASP.NET webforms app that will serve as a simple intake form to create work items in TFS 2010.The app works correctly when I run it locally in debug mode--the submission completes and the work item is created.

When I publish the form to our dev server, it yellow screens and throws the following error:

[SecurityException: TF50309: The
following account does not have
sufficient permissions to complete the
following permissions are needed to
perform this operation: View
collection-level information.]

In my code, I'm attempting to access TFS using a service account, and from what I can tell the service account is being used correctly when I run in debug mode.Here's what my C# looks like:

string tfsServerUrl = "http://servername:8080/tfs";
string tfsProject = "Web Team Projects"; [code]....

If I set a breakpoint at the tfs.Authenticate() line, the server object shows the service account name as the current user and IsAuthenticated = true.

The line in the exception that mentions SERVERNAME$ is what's stumping me. It's seems like IIS is deciding to try to access TFS with the app pool identity instead of the credentials that I'm explicitly supplying.Our dev server is a Server 2008 box running IIS 7.

View 1 Replies

C# - Adding New Option In Sharepoint 2010 Site Actions?

Mar 8, 2011

I am working on sharepoint server 2010. I want to add an option to

Librart Tools ribbon
Share & Track

By default a link called "E-mail a Link". How can i add custom link by using feature enabling programatically.....?

View 1 Replies

Visual Studio :: 2010 Reformatting And Adding Code

Dec 4, 2010


I'm working on the following aspx file, and for some reason VS2010 is messing with my code. I have no idea why, and was hoping one of you could have a look at it.

What happens is that most of the times when I hit ctrl+s, it add some code to the end of the file.

View 1 Replies

VS 2010 Image Gallery - Adding Previous And Next Button

Jun 30, 2012

I know a little bit of vb.net but don't know all that much about the asp.net technology. I do some volunteer work for a non profit organization and what I'm trying to do is integrate an image gallery into their site, instead of using an external image service that they use now.

After some searching I found an easy to use program that automatically creates the necessary thumbnails in a table.

However I want to add some functionality; when a user clicks an image for full size I want to add the option to click a button or link, to get to the next image.

I've done a lot of searching but couldn't find how to achieve this. I guess I need to find out the current image and then somehow jump to the next image.

How to implement this. Preferably I'm looking for something that is easy to implement. I'll have a number of different albums with a different amount of images. If possible I'd like to avoid having to rename the images so that they are photo1, photo2 etc.

Currently the image gallery looks like this : [URL] ....

I'm pretty sure I will need to make some changes to the viewimage.aspx file. Currently it only contains:

vb Code:
<img border="0" src="<%=Request.QueryString("img")%>" alt="" />

Not sure if you need to know the code that does the thumbnailing + creating clickable thumbnails, but I'll post it just in case it's needed

vb Code:
<script language="c#" runat="server"> void Page_Load(Object sender, EventArgs e){   
// Modify these numbers for the thumbnail size you want    const int maxWidth  = 200;    const int maxHeight = 200;       
ArrayList pics = new ArrayList();    string html;    int imgHeight;    int imgWidth;    foreach(string s in Directory.GetFiles(Server.MapPath(""), "*.jpg")){      System.Drawing.Image currentImage = System.Drawing.Image.FromFile(s);     

[Code] ....

I got the code from here: [URL] ....

but the contact button doesn't work, otherwise I would have contacted the original author.

View 3 Replies

VS 2010 - Adding Index To Listbox Values During Population

Jun 27, 2014

I have a SQL table used by a third party application that I have very little control over. The table contains a list of assemblies and their corresponding serial numbers. The tables primary key is a composite of the assembly number and serial number. There is no field I can use, reliably as an index.

I have an application I'm working on that pulls all the serial numbers from that table based on the assembly in a SQL View. I've then written code that pulls the serial numbers from that view based on the part number in a textbox on the form. That functionality works fine but I had both my datatextfield and datavaluefield set to the serial number. I've created another empty listbox that I would like to populate from a serial number or serial numbers being selected in the first. That is not working, I believe, because there is no index for the list.

My question is...How can I add an index value to each serial number as they populate from the SQL table. I've included the code below that I have pulling the serial number values.

This is an ASP.net VB webform.

Private Sub FillSnAvailList()
Dim strconnect1 As String = ("Data Source=MyDataSource")
Dim con1 As New SqlConnection(strconnect1)
Dim cmd1 As New SqlCommand("SELECT [sPartNum], [SerialNum] FROM [V_MaxSerialNum] WHERE ([sPartNum] = @sPartNum)", con1)

[Code] ....

View 3 Replies

C# - How To Make The Gridview Headers To Links

Apr 22, 2010

I want the headers of my gridview to be hyperlinks, without the "SortExpression"...I searched the net, but I've been not very succesful.

For example: when clicking on the header of a simple gridview, the site navigates to a webpage. Is it possible?

View 3 Replies

VS 2010 Adds Colgroup - IDE Stop Adding Extra Elements?

Jan 20, 2011

I have a code like the following:

<col width="50%" />
<col width="50%" />
blah blah

When i switch to design and get back to source view it added the colgroup so my code looks like this:

<col width="50%" />
<col width="50%" />
blah blah

how to make the IDE stop adding these extra elements? i changed the Target Schema to all possible combination and it didn't help.

View 9 Replies

C# - Adding A Solution File To 1.1 Application Using Visual Studio 2010?

Nov 30, 2010

I'm trying to migrate an old asp.net 1.1 application to target the new .net 4.0 framework. There are good guides available on this [URL]. However, all approaches start with the assumption that the 1.1 project contains a solution file which one has to open using VS 2010 and go through the conversion wizard.

In my case, the project does not have any solution file, giving me a sort of chicken and egg issue.

Is there a way to add a 1.1 .net soution file with or without VS 2010? Using command line tools? What is so special about a solution file anyway?

View 3 Replies

Adding A Tool Bar To Visual Studio 2010 - Windows From Application

Nov 7, 2010

i just downloaded an RSS Toolkit for .net.

where do i need to place it? in which folder so it will become available on my visual toolbars?

and what types of files do i need to place in this folders? is it the *.dll only or more?

View 1 Replies

Visual Studio :: VS 2010 Crashes On Adding Class Attribute?

Jul 29, 2010

VS 2010 crashes instantly when I press = when adding the class attribute to anything.

The exact error I get is

Microsoft visual studio 2010 has stopped working.

Adding any other attribute works fine.

View 4 Replies

Visual Studio :: Adding New Controls To Project That Was Converted To Vs 2010?

Jan 4, 2011

I have a vs 2008 project that I converted to vs 2010. I added a label to my aspx page but I couldn't get it be recognized in the c sharp until I realized that it wasn't added to the designer.cs file. I added it to that file like this:


and it worked fine. Why would I have to add something to the designer.cs file though? Shouldn't this have been created automatically when I built the project?

View 1 Replies

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