I have an ASP.NET/C# web application that has a GridView control. In the last column of that GridView control I have a template field that contains a menu. In the OnMenuItemClick event I get a reference to which row the event was fired from, in order to determine what value the ID field contains for the current row. Currently I reference this cell by it's index "gvr.Cells.Text". However, this is highly volatile since any changes to the location of the ID column breaks the code. How can I instead gain the value in the cell that has a column name (or some other name-like property) of "SomeID" from a GridViewRow reference?
I have a ASP.NET/C# web application that contains user controls with GridView controls. The GridView controls contain the following column types.
CommandField - Contains buttons like Edit, Select, Delete, ... BoundField (x8) - Contains the data fields from the database. TemplateField - Contains a single ASP:Menu control.
The menu control consists of the following structure.
Navigate To (Parent MenuItem) - Location A (Child MenuItems) - Location B - Location C - Location D - Location E
What I need to do is when the OnMenuItemClick event is fired, determine which menu item was clicked (already done) and then capture what the value in the first BoundField cell is for the row that the menu item was clicked on.
So, for instance if I have three rows in the grid with the first BoundField column containing the IDs 1, 2 & 3. Then I hover my mouse over the menu on the 2nd row, and click the menu item "Location C". The "Menu1_OnMenuItemClick" event is fired and I can determine that "Location C" was clicked by e.Item.Value == "Location C".
However, how do I navigate up through the API to determine what the contents of the cell in the first bound field column are for the row that was clicked on?
i have a GridView in my page that is associated with the database table "Blogs", GridView is showing all the table data correctly, i have added a link button column in the GridView, which is not defined or constructed in the Database table... I want that when i click on the button against a row in the button column of the GridView, the B_Id column cell value is passed to the other page, and control goes to the other page.
I have a GridView, in which the width of each column is dynamic and changes depending on the dataset. I need to get the width of each column for use in my PDF exporter, but the column/cells width is always '0', presumably because I haven't set the width property.
I am using GridView ,I want to do a validation like if i edit any one of the Cell in that column, it will through the validation when the sum of column value is more than 100. How can i do this validation?
Inside an UpdatePanel a Gridview will be filled with data (AutoGenerateColumns=true). The data will be different each time (coming from different database tables) - if the corresonding DataTable contains a specific column (identified by name) I know that the datatype is "Xml". In this case I don't want to show the content, I want to add a button instead. And if the user clicks this button a new browser window should be opened to show the xml-data.
Therefore in the "RowDataBound"-event I added a button to the corresponding Tablecell. This works but I don't get the click-event of this button (I get also no "RowCommand"-event when working with command name). It only "refreshes" the UpdatePanel I guess (because instead of the button, after the click I get the original xml-data in the TableCell because "RowDataBound" will not be fired).
What I need is the following:
- AutogenerateColumns= true
- Adding in a specific column a button instead of the xml-text
- An event, where I can identify which row was sender of the click so that I can show the xml-data in a seprate browser window.
I have a gridview with a button field and a select field, The select field does what is supposed to do on gridview selected event, but how do i tell it to do something different if the button field is selected.
I want to show student attendance report on grid view with present and absent facilty using two radio butons on seprate column.Now i want user can select either present or absent radio button.I tried so much but i failed every time
I developed the grid view in which i define 2 columns(Common Name, Common ID). I wanted that when i edit particular cell of grid; if i select any cell of column "Common Name" then it tells the name of particular column name and when i click on any cell of column "Column ID", it shows that column name.
i am working with a gridview and created it in following way:
Now i want to remove the Select, Edit and Delete link buttons in the last columns for a particular row. It should remain as it is for other rows. Only linkbutton from a particular row(being determined from data key) is to be removed.
As per my requirement, I am getting CompID, Company Name and URL from SQL database. I want to display just CompName and URL in gridvew. So, I need to hide the CompID in gridview. One way I can do BoundField field Visible to false but I need to retrive that compID id when user selected any of the row. if I set visible to false user wont see any compID in gridvew but I want access the selected compID also using SelectedRow.Cells.Text..