.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

add image as grid column then send ID to edit on image click

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :ASP.Net

hello - new to webmatrix and C# so probably playing with fire here....  

I have a page that allows a user to add, edit, list, and delete database items.  I would like to add an "edit" graphic to each row in the list.  Something like this:

    <div id="grid">@grid.GetHtml(
    columns: grid.Columns(
        grid.Column("<img src="editfield.gif" />"),

up above I have:

        var SQLForGrid = db.Query("SELECT * FROM Books");
        var grid = new WebGrid(source: SQLForGrid, defaultSort: "Title");

then when the edit image is clicked it should send the page the id of what they want to edit.

any help/ideas are appreciated.

View Complete Post

More Related Resource Links

How to Click image to Navigate to next image

 In Detail.aspx , I know this code will show the image <img src="Handler.ashx?PhotoID=<%# Eval("PhotoID") %>&Size=L" class="photo_198" style="border:4px solid white" alt='Photo Number <%# Eval("PhotoID") %>' /> And does any one could add a URL href to allow user navigate to next image via click current image ?   

ssis sql 2000 image to 2008 varbinary Failed to retrieve long data for column

Hi, I have a task that to migrate the image type column from sql 2000 to varbinary type in sql 2008. The source column having 3812353 max datalength size for the column. The package always failed with following error message. [OLE DB Source [13177]] Error: Failed to retrieve long data for column "attch_file_content_t". [OLE DB Source [13177]] Error: There was an error with output column "attch_file_content_t" (13209) on output "OLE DB Source Output" (13187). The column status returned was: "DBSTATUS_UNAVAILABLE". [OLE DB Source [13177]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "output column "attch_file_content_t" (13209)" failed because error code 0xC0209071 occurred, and the error row disposition on "output column "attch_file_content_t" (13209)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure. Meng Chew

grid view image delete problem

i have a grid in which i am showing a record with image, when user delete the record the image also deleted and when it again enter the record it upload the new image but display the deleted image from the cache example: name.jpeg upload, then deleted, a different file with the name.jpeg upload, it showing the deleted one. 

Up Down GridView Icon Image for Column Sorting

I'm trying to add an Ascending and Descending sort direction Icon Image next to the header text of my ASP.NET 2.0 Gridview Columns.I've searched and found some examples that seem to do this but have had difficult time recoding them from C# to VB or some just seemed overly complex for what I want to do.Does anyone have a simple VB solution for sort icons?Thanks,Ethan   

Insert Image column in External content type

Hi,   I've created an external content type. It pulls in data from SQL Server Database. I need to have the first column as an image based on the value of one of the columns. Could anyone please suggest how to add a column so represent an image in external list.   Regards, Zia

Image stretch inside a grid stops working horizontally once columns are added to grid.

I have a simple setup of a window. Window contains a grid, inside the grid there is an image. I want the image to always stretch across the entire cell. I've set it's Stretch property to Fill and it works fine, as long there is only one column in the parent grid. As the window is resized, the image stretches correctly. As soon as I add another column, the image stops stretching horizontally. Vertially it works just like before, horizontally it now appears with a fixed width corresponding to the width of the picture used as the source. Does not matter which column it's positioned in, and I've tried encapsulating it into another grid but behaviour does not change. It behaves the same in both Visual studio 2010 designer and at runtime. In addition when I tried to encapsulate it in a second grid, this seond grid also now has altered behavior - instead of sizing itself to it's container (both height and width are not set) as it's parent grid does, it now sizes itself to its contents - the image. But only horizontally. What is going wrong here, is this a bug or am I missing something, and any advice on how I can get the image to fill one of the cells of a grid with more then one column?

Can't edit metadata when showing the image.

I have an app that in the Left-hand pane Reads the filenames of the images in a folder and places them into a ListBox.  In the Right-hand pane there are a series of TextBoxes showing various pieces of metadata from the selected image file.  I can read and update the metadata with no trouble. As soon as I place an acutal image in the ListBox it stops updating.  Delving into the class for the metadata tells me that it 'Unable to get writtable property store for this property.'  I believe this is because with the image open in the ListBox it can't update the file. Is there a way to place an image in the ListBox without keeping the original image file open, maybe by using a clone, a thumbnail, or something. Following is is my image class.  You can see what I had to comment out to get it to work. Namespace Image.Viewer     Public Class MyImage         Private _image As ImageSource         Private _name As String         Public Sub New(ByVal image As ImageSource, _                                  ByVal name As String)           &

image button click in listview with scriptmanager

 I am using scriptmanager in masterpage and my imagebutton click event is not being found in code behind and my javascript is not working and no events are firing. In fact, the imagebutton does not change the mouse icon to a hand when hovering... help!  <asp:UpdatePanel ID="upTabControl" runat="server" UpdateMode="Conditional"> <Triggers> <asp:AsyncPostBackTrigger ControlID="tabControlScriptManagerTabStrip" /> <asp:PostBackTrigger ControlID="scriptManagerTabStripMultiPage" /> <asp:AsyncPostBackTrigger ControlID="ctrl_List_View_Images1$lv_Items_Images" /> <asp:AsyncPostBackTrigger ControlID="ContractDocumentUpload1" /> </Triggers> <ContentTemplate> <telerik:RadTabStrip ID="tabControlScriptManagerTabStrip" runat="server" SelectedIndex="0" Skin="Web20" MultiPageID="scriptManagerTabStripMultiPage" AutoPostBack="True" OnTabClick="RadTabStrip1_TabClick"> <Tabs> <telerik:RadTab Text="Blog" runat="server" MultiPageID="scriptManagerMultiPag

How Do You Insert An Image From The Image Folder Into A Binary Column?

Hello Forum, How would I go about inserting an image that's in my images folder into a sql table column of datatype varbinary(MAX) ?    Thank you

Send image


Hello people, I currently got a piece of code that send an image through tcp, this seems to work on any pc that is connected to my own network but when people connect to my real IP nothing seems to happen, here is the code.


 public Form1()
      var t = new Thread(startListening);
      t.IsBackground = true;
    public void startListening()
      check = true; 
        while (i < 1)
          data = new byte[1024];
          ipep = new IPEndPoint(IPAddress.Any, 9050);

          newsock = new Socket(AddressFamily.InterNetwork,
                  SocketType.Stream, ProtocolType.Tcp);


          client = newsock.Accept();
          IPEndPoint newclient = (IPEndPoint)client.RemoteEndPoint;

Sharepoint image column field

My current project requires ability to display choice column value via color or image associated with a choice 

But Sharepoint standard packaged misses that control 

I am looking for available solutions on market 

I came across 

Does anybody has experiece using it?

Can a gridview contain an image and text in the same column?


I have a 1-column gridview (and it must remain 1-column) which contains only text.  My requirement is to prefix each row with an image followed by the text.  The image may or may not be indented a bit, like an expanded child node in a tree.

I know a gridview renders as a table and I know I could put an image at the beginning of each row in a table (using a repeater, for example).  But this is an existing app with a couple gridviews which need to be enhanced and I don't have the time to swap out the gridviews for repeaters.

I can't find any reference anywhere on the 'net which deals with this topic.  Anyone have any ideas?

Thanks in advance,


 - C# & .Net v4

Storing Image in database as image type and viewing it on grid view


 how can i store image into database and view it in grid view?

how can i call the AsyncFileUpload's click method by a image



i want to make something like that

<cc1:AsyncFileUpload runat="server" id="upload"

<img onclick='upload.click()'/>

i tried lots of script but it doesnt work. Can anyone help?

Send Image via Javascript


I am trying to accomplish the following with javascript and .NET:

I have two websites.

When a user is surfing website A, the user sees a picture of a fat lady. When he clicked on the picture, the image is sent (via javascript) to website B.

Website B is running .NET, and the image must be sent directly from the client (not from website A).

Is this possible?

Sending email from Image on click



In my SharePoint Webpart page( available under Pages - Web part page) , I have added a Content editor webpart. I have added an image(Not button) inside the content editor web part.

I want to send e-mail, when users click on the image.

How to achieve this?

Thank you

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend