.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

Help needed with coding an edit column

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :ASP.Net

I have a GridView I've displayed using the following codes:

In the file root/App_Code/ConnectionManager.cs:

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Configuration;

namespace rankings
    internal sealed class ConnectionManager
        public static SqlConnection GetConnection()
            string connectionstring = ConfigurationManager.ConnectionStrings["yafnet"].ConnectionString;
            SqlConnection connection = new SqlConnection(connectionstring);
            return connection;

In the file root/App_Code/prDAC.

View Complete Post

More Related Resource Links

DataGridView>Edit Columns> Column Read Only property is unwilling to change

Hello, I am facing the following mystery: When changing the read only property of a column to false and reopening the "edit columns" window, it mysteriously turns back to true. Even when closing the designer and changing it in the designer code, the resulting execution does not allow edit, as well as when re-opening the designer you see true again.             this.numberDataGridViewTextBoxColumn1.DataPropertyName = "Number";             this.numberDataGridViewTextBoxColumn1.HeaderText = "Number";             this.numberDataGridViewTextBoxColumn1.Name = "numberDataGridViewTextBoxColumn1";             this.numberDataGridViewTextBoxColumn1.ReadOnly = true;//False is required We thought it might be related to data binding. rebinding the grid did not help as well. The is no other place in the code where it changes. Please advice, Thanks

Why are square brackets needed for column names

Hi I'm just trying to get used to using Joins if anyone can please tell me why this only works if I put the column name in square brackets. I only managed to work this out because after struggling I had look at how it should look when designing a New View. This works :- SELECT FoodInv.Calories FROM (FoodInv INNER JOIN Diary ON Diary.FoodIndex = FoodInv.[Index]) WHERE Diary.Date = '2010-09-05' but this didn't if I leave out the square brackets :- SELECT FoodInv.Calories FROM (FoodInv INNER JOIN Diary ON Diary.FoodIndex = FoodInv.Index) WHERE Diary.Date = '2010-09-05' Without the brackets would generate error within the Messages window :- Msg 1018, Level 15, State 1, Line 7 Incorrect syntax near 'Index'. If this is intended as a part of a table hint, A WITH keyword and parenthesis are now required. See SQL Server Books Online for proper syntax. Any hints are welcome. Thank you. Matthew

Uploading Excel 2007 table into WSS 3.0 - How does SharePoint decide the column that is used to edit

Hi, In Excel 2007, there's an option to upload (export) an Excel table into SharePoint.  The range of cells have to be identified as a table.  In the Table ribbon, there's an Export button.  When I upload the Excel 2007 table, SharePoint (WSS 3.0) decides which column in the table will be linked to the properties dialog box for each line in the table.  It seems to be a sporadic decision on the part of SharePoint. Does anyone know how WSS 3.0 decides which column will be linked to properties?  And, is there any way to control this when uploading the file? Thanks!Thanks! Patti N.

how to edit the list column



i am working on ListViewWebpart i am trying to modify list column height , is there any quick way to do it.  i am using SPD 2010.


 <td class = "ms-vb-tall" colspan="{$NumColumns}" style="height: 15px">

i want to change the height as 10px. i have tried but it is not reflecting on home page.


Aboslute path needed for hyperlink column



I am working on data datagrid and getting 1 column as Hyper Column 


the Hyperlink Column is declared as 


<asp:HyperLinkColumn DataNavigateUrlField="Path" DataTextField="SongName" 

                    HeaderText="Songs" Target="_self" DataNavigateUrlFormatString="/{0}"></asp:HyperLinkColumn>

where SongName and Path are coming from database



now the values of Path is in the format "http://abc.html"

however when I click on the grid it gives me something like this http://localhost:XXXX/http://abc.html


Please tell me how to convert this relative path to absolute path.

Edit ID column?



I am wondering if there is a way to edit the read only column "ID" in a Contacts list in MOSS 2007.  I need to reorder the ID numbers as I am pulling the Contacts into an infopath form and it will only display them in the order of their IDs, not names. 



How to make a sharepoint list column readonly or invisible while add/edit list item in sharepoint UI


 Hi Everybody,

I have created a list in sharepoint. In that list there is a field which I want to make read only or invisible when the user tries to add or edit a list item through sharepoint UI. I want this because that particular field gets populated through a webpart and direct data entry into that field is unnecessary. Is there any way to make a sharepoint column (for me its a picture column) read only or invisible in the sharepoint UI.

thank you,

Arun Dutt

Entering edit mode with RichTextBox in a DataGrid column


Hi guys,

I have a DataGrid TemplateColumn with a readonly RichTextBox in its CellTemplate and a (editable) RichTextBox in its CellEditingTemplate. The problem is that when I double click the RichTextBox, it selects its text instead of bringing the DataGrid to Edit mode.

As a workaround, I hooked PreviewDoubleClick on the RichTextBox and called DataGrid.BeginEdit(). Although this does bring the editable RichTextBox but the Caret is always at the beginning of the text instead of the location where I double clicked.

Any Ideas how to handle this?


Syed Mehroz Alam
My Blog | My Articles

coding help needed


Write a SELECT query to show those users who have not purchased a product with the following product’s title:

'Data Modeling ' In the result table, show users’ last names, email addresses, and the role names of these users


The table relation is as follows:

USER                                                                   USERROLE                                    ROLE

-------------        &

Edit all cells within a particular column => Gridview (vb code)


Hi there,

I'm looking for a technique to edit a whole column (vertical) instead of a row (horizontal).
Suppose i have 10 rows en 5 columns (like in Excel), and i want to edit all digits from different students (rows) for test number 3 (column).

How can i do that?

Can someone help me out here?



How to show column value in display mode and hide in edit mode?


How to show column value in display mode and hide in edit mode for my custom page layout?

I need similar functionality like PublishingWebControls:EditModePanel with contrary behavior.

I cannot use nor server-side code neither third-party web-parts. Only pure APSX+SP Contol Libraries and client JS allowed.

Variable column name in GridView edit mode



I have implemented globalization in my website by using Global Resources. I thought of implementing it not only on controls but in database fields. So for some columns which would be single columns in normal conditions, I considered multiple columns for different culture. For example if there was a [Title] column, I replaced it with [Title-en-US], [Title-en-GB], [Title-es-ES] and etc.

I have a web page with a GridView control that displays the content of that table. In a normal case (without globalizing),  I would have a TemplateField in the GridView like this:

                        <asp:TemplateField HeaderText="Title" SortExpression="Title">
                                <asp:Label ID="Label1" runat="server" Text='<%# Bind("myTable.Title") %>'></asp:Label>
                                <asp:DropDownList ID="DropDownList1" runat="server" AppendDataBoundItems="true" DataSourceID="myDataSource"
                                    DataTextField="Title" DataValueField="XID" SelectedValue=&#

Sharepoint List - Column Descriptions are Not Displaying on the Edit Form

I have created a Sharepoint List that contains multiple columns of different types (text, choice, currency, etc).  I added descriptions for most of the columns, but only a few of the descriptions are displaying on the Edit Form.  It doesn't seem to matter what the column type is....as I have a description displayed for one text column but not another.  Is anyone aware of any limitations to the display of the column descriptions on the Edit Form?  The current platform is Sharepoint 2007. 

jQuery jqGrid Edit Column



I have sucessfully managed to set up the jqGrid and have it so that when a user clicks a row the final column turns into a combo box with three possible values. When they select a value and then select the next row the value is saved to the database.

What I need to do next is have it so that if they select option 'R' in the combo box I display a modal popup asking them if they definitely want to do that and making them provide some more information. But I'm having trouble figuring out how to access an event handler for the combo box in the grid so that I can do some sort of selectedindexchanged event.

Can anyone help?


How to Change The Column That Is Linked To Item With Edit Menu

How to change the column that is linked with edit menu
Thanks & Regards, Sruthi

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


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.

Inplace Edit in GridView

In this article I am presenting a different way to look at EditItemTemplate, using which user navigation for editing is reduced and . it looks very different (see screeen shots) then regular implementation of GridView.
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