DataSource Controls :: Making A LINQ To SQL Gridview Column A Clickable Link?

Feb 24, 2010

I have a database table column consisting of text URLs [URL] In my LINQ-to-SQL-driven gridview, I want to make this a clickable link programmatically, with differing link text (e.g. "Link text"). I'm getting close but am missing some key concept. Here's the core of the .vb codebehind:

Dim dctx As New ResourceMod.ResourceModDALDataContext
Dim eleResObj = From eleRes In dctx.Resources Where eleRes.Type = "url" Select siteurl = eleRes.Website
GridView1.DataSource = eleResObj
GridView1.DataBind()

This displays the raw URL in the gridview (i.e. non-clickable). I've experimented with adding an explicit hyperlink column a la [URL](setting AutoGenerateColumns false etc.), but haven't yet figured out how to assign the asp:hyperlink Text and NavigateUrl fields with the anonymous-type object eleResObj. Using a field construct such as Text='<%# Eval("siteurl") %>' isn't working, presumably a scope issue. Is a LinqDataSource needed in this case, and if so, how would that affect the original LINQ query?

View 2 Replies


Similar Messages:

Forms Data Controls :: Making A Row Of A Designated Column Clickable To See The Details In Another Page?

Apr 10, 2010

I have a GridView which is linked to the database via SqlDataSource.

What I would like to do is to make each row of a designated column clickable. Once the user has clicked on a row, the application should postback to another page to allow the user to read all the details of that row.

The effect should be as we can see in this post: if you go to "mypost", you have a list of posts and then when you click on one of them you are able to see the details of that.

I read lots of posts that are using, however, other methods such as datalist + dataset controls etc.

View 3 Replies

Forms Data Controls :: GridView Row Select / When Mouse Is Over Checkbox Column It Should Not Be Clickable?

Mar 14, 2011

I have a gridview that includes a checkbox colum (Item Tempate).I need to be able to select row but when mouse is over checkbox column it should not be clickable. Is this possible?Think of it as an Inbox type gridview where checkbox is used for deleteing messages but when you click on subject or name it will show the message. I need the same functionality.

View 7 Replies

Forms Data Controls :: Making Entire Row Selectable Instead Of Just The Select Link / Button In Gridview?

Sep 20, 2010

I have a gridview setup and have the select button enabled. I also have a gridview that doesnt have a select button enabled..

On them both, if its possible, i would like to make the row itself selectable instead of just enabling the select button.

View 2 Replies

Variable Value As Link / Return The value As A Clickable Link?

Jan 25, 2010

Created a asp page using vbscript to calculate a value (works fine). I'd like to return the value as a clickable link, which would obviously redirect the user somewhere else.

View 9 Replies

Forms Data Controls :: Making Visible Of Gridviwe Column If All Values In Selected In A Column Is Not Null

Dec 30, 2010

I have gridviwe having 2 columns:

1) DocNumber 2)Title

query select docnumber,title from tbl_docs.

BindwithGridviwe(sql);

Now the issue is that that every document doesn't has document number. I want to make invisible the docuNumber column of the grid viwe if all values in the docNumber retrieved are null.for example:

docnumber tite
null Document 1

null Document 2

null doucment 3

null document 4

if returned result match above where all docnumber are null then make the gridviwe docnumber column ivisible eslemake the greidviwe column visible.

View 4 Replies

DataSource Controls :: LINQ - Select Column In Data Table?

Feb 9, 2010

Mmy data table has four columns. How can I get only selected columns name?

View 5 Replies

C# - Gridview Making A Column Invisible?

Jun 17, 2010

I have a grid view which is dynamically generated via C# using a DataSet. I'm passing a row ID field (from the database) to the grid view, as this is required when a user clicks to edit a records. However I don't want the user to be able to view the column.I have tried the following but it doesn't seem to work? hide the column or a better way of attaching the information to the grid view row so it can be used at a later stage. c#

DataColumn ColImplantCustomerDetailsID = new DataColumn();
ColImplantCustomerDetailsID.ColumnName = "Implant ID";
ColImplantCustomerDetailsID.DataType = typeof(int);
ColImplantCustomerDetailsID.Visable = false; <-- visable doens't work here.
asp.net

View 4 Replies

DataSource Controls :: Linq To Sql: How To Retrieve Identity Column Value Before For Inserting Any Record

Apr 3, 2010

I am in a serious trouble right now, i wanted to know that how to write a query in LINQ to SQL to retrieve identity column's current value before inserting any value.

I need this cos i m building a windows app n i need to display this value before inserting a record. I have tried DataContext.ExecuteCommand('DBCC CHECKIDENT (Tablename)') but it returns the number of rows modified.

View 2 Replies

DataSource Controls :: Add Read Only Computed Column In Linq To Sql Designer (dbml)?

Feb 7, 2010

How do add read-only computed column in LinqToSql designer (dbml)? My existing table structure:

Name: ID, Type: int, AutoGenerate: true, AutoSync: OnInsert, PrimaryKey:
true, ServerDataType: int not null identity, Source: IDName: Name, Type: string, ServerDataType: nvarchar(100) not null, Source:
NameName: Value, Type: byte[], ServerDataType: VarBinary(max), Source:
Value, UpdateCheck: Never

I want add the 4th colum name: Name: HasValue, Type: bool --> [Value] != null

View 1 Replies

How To Send A Clickable Link Which Works In Outlook And Hotmail

Dec 29, 2010

i need to send a clickable link to many people via mail using vb.net .

Dim smtp As New SmtpClient
email = "emailaddress@xyz.org
Dim mm As New MailMessage("test", email)
mm.Subject = "test"
mm.Body = "http://www.mywebsite.org/mypage.aspx" & "<br><br>" & "greetings"
mm.IsBodyHtml = True
smtp.Send(mm)

This code works perfectly when the mail is read with Outlook. People get a clickable link which brings them to the right page. But the same mail read in Hotmail (or any webmail site) provides a non-clickable link.

I also tried with:

mm.Body = "http://www.mywebsite.org/mypage.aspx" & chr(9) & chr(13) & "greetings"
mm.IsBodyHtml = False

but then, i get no clickable link in Outlook.

How can i send a clickable link which works with Outlook and Hotmail?

View 5 Replies

JQuery :: Display Comments And Clickable Link In Datalist?

Jan 21, 2011

I am a new coder trying to experiment with jquery for my first time. I'm trying to setup a simple datalist that might be used to display comments for an item. I want a clickable link (per datalist row) to drop down a panel (per datalist row) that has comment text. so the user looks at row 1, clicks it's link to read comments, and the comments panel drops down. they scroll down and do the same for the next item.

so far i have the below code as a small test page, but it's not working. nothing happens basically. I tried the clientID thing because it seems i need that to deal with the auto-generated ID's .NET will assign panels as it's rendered, but i'm not sure if i'm doing it right.

[Code]....

body

[Code]....

View 4 Replies

Forms Data Controls :: Adding A Link Column To GridView With User's ID?

Aug 18, 2010

I have an accessdatasource that pulls several columns from my users table including [userID]. Then I have a gridview that displays all this information by autofilling the columns. Finally I have added a column that I want to link to viewUser.aspx?userID=####. The #### would of course be from the query.

Here's my column that I've added:

<Columns>
<asp:HyperlinkField datatextfield="View User"
datanavigateurlfields="userID"
datanavigateurlformatstring="viewUser.aspx?userID={0}"
headertext="Link"
target="_blank" />
</Columns>

This is my first time using this so I'm not sure what's wrong. I don't understand the '{0}' part and that's also where the problem lies. On the viewUser page when I print the querystring("userID") it just shows {0} as expected. How do I get my userID in there?

View 6 Replies

DataSource Controls :: Create A Multi Column Listbox By Combining Fields In Linq Select Statement

Jan 11, 2010

I am trying to create a multi column listbox by combining fields in Linq select statement, as Let Name = Last + First. The problem is how to pad the Last column with spaces as you would in SQL using REPLICATE so when I bind the listbox to the data, it looks like two columns.

View 5 Replies

C# - Make First And Last Column Not Clickable?

Oct 19, 2010

I have a table being generated in an ASP.net web app. The table has 4 columns. Currently each cell of each row can be clicked to get more detailed info. However, I do not want the first and the last cell in each row to be clickable. How can I make it so that only the first second and third cell can be clicked?

Below is some of the code (from the .cs file):

if(e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.BackColor = TRADER_BACKCOLOR;
e.Row.Cells[0].Font.Bold = true;
e.Row.Attributes.Add("onmouseover", "style.backgroundColor = 'Silver'");
e.Row.Attributes.Add("onmouseout", "style.backgroundColor = '" + TRADER_HEX + "'");
e.Row.Attributes.Add("onclick", "RowClick(this, '" + e.Row.Cells[0].Text + "');");
From the .aspx file:
function RowClick(caller, id)
{
if(document.getElementById(id).style.display == "block")
{
if(last != "" && parent == id)
{
HideDetailed();
}
document.getElementById(id).style.display = "none";
}
else
{
document.getElementById(id).style.display = "block";
}
}

View 2 Replies

ADO.NET :: How To Get Column Names From Linq Datasource

Jan 14, 2011

how to get column names from linq datasource?

[Code]....

View 7 Replies

Forms Data Controls :: Link Checkbox With Bit Column, So Bit Column In SQL Database Gets Updated?

Mar 6, 2011

I'm currently working on a small project and therefore created a gridview, including one bit column which has been linked with a checkbox in both the itemtemplate as the edititemtemplate (autopostback = true).Databinding for these two checkboxes has been linked (two-way) to the bit column.Now I want to display the gridview to end-users. They should be able to just click on the checkbox so they value in the database column gets changed as well (as I want to run update queries behind it), but not passing via the command column 'EDIT'.=> problem I'm having now is that the bit column in the database doesn't get updated.

View 3 Replies

Forms Data Controls :: Make Gridview (3.5) Clickable?

May 21, 2010

How do you make a gridview(asp.net 3.5) clickable? In other words how can I make it so that I can select a row in the grid? In fact click on any row.

View 10 Replies

Forms Data Controls :: Hyperlinkfield In Gridview Not Clickable?

Apr 18, 2010

Was working fine and all of a sudden I can't click my column any more!??

Here's the code...[Code]....

View 2 Replies

Forms Data Controls :: Change Gridview Datasource By Clicking A Link?

Apr 20, 2010

i'm working in visual studio 2005 c#

how do i change gridview datasource by clicking a link ;

how do i insert code to the onclick evvent to change the data source ?

View 2 Replies

DataSource Controls :: Gridview Using LINQ To DeleteOnSubmit?

May 28, 2010

I continue to get compiler errors. I have a Gridview (with Delete and Edit buttons) that I populate via LINQ with e-mail addresses. When they hit the delete button I want to use LINQ to delete the row from the table based on the GridView DataKey. If I use Response.Write(ID) it will show the ID number for the Email that I want to delete.Here is the error:

"Error 2 The best overloaded method match for 'System.Data.Linq.Table<Email>.DeleteOnSubmit(Email)' has some invalid arguments C:InetpubwwwrootXXXXXXXXXEditEmail.aspx.cs 53 13 C:...XXXX"

Here is my code behind:

[Code]....

Here is my Gridview code:

[Code]....

View 1 Replies

DataSource Controls :: Linq Object To GridView With Formatting?

Jan 21, 2010

I want to display a Gridview of Patients before I submit them to the database. Is there a way(better way), other then List<Patients>, to bind a list to a GridView.

I am using Linq to SQL and I have a DAL with the Patients table inside. I create a new list of Patients

[Code]....

Now the problem is I can't use a Linqdatasource or Objectdatasource to link to the GridView as no data is in the db yet. The only thing that works is GridView.DataSource = _patients; but I lose all automatic formatting and as far as I can tell it is going to be a pain to format manually. It would seem I should be able to somehow link my object _patients to an one of the datasourses so I would have formatting and all.

View 2 Replies

DataSource Controls :: When Use LINQ To Handle The Paging Of Gridview?

Jun 28, 2010

Both the Method 1 and Method 2 can handle the paging of GridView, could you tell me how about the performance of the Method 1?and how much will Method 1 slower than Method 2

#region ForPaging
public static List<HD_ToDoList> Get_ToDoListByUserNameForPage(string username, int StartIndex, int PageSize)
{

[code]...

View 3 Replies

DataSource Controls :: Sorting Gridview Control Using LINQ?

Jun 8, 2010

I have Gridview control which bind data from LINQ datacontext object which use store procedure. sort the gridview using LINQ datacontext object which use store procedure.

View 3 Replies

C# - SP Gridview Link Button Column Not Working

May 17, 2010

I have one sharepoint custom page application which is rendering from a user control. In the user control page, i had used SPGridview for displaying data. My first column is Title Column (link button column), when the user click on the link, then one popup window will open with corresponding data. But the problem is the link button is not working properly. But this application is working as fine in asp.net application.

My code is shown below..

[Code]....

If i click on the link button, there will be only post back occuring. but not the popup window open.

View 1 Replies







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