Search Results

Search found 1260 results on 51 pages for 'gridview'.

Page 21/51 | < Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >

  • Edit first column of GridView

    - by nCdy
    I've got very dynamic GridView and I need to allow to user to edit first column of it. After he edit first column of grid it must be updated on DataBase. Is there any ways to handle it ? My only idea is to put some changeable element to first cell of each Row so it must be able to set / get my values for each row but can't find yet any examples of it ... Additional info : GridView takes data from Object data source and all columns are dynamic (yes, maybe except first, but I add it in dynamic way) and load complete DataTable...

    Read the article

  • Dynamically Added CheckBox Column is Disabled in GridView

    - by Mark Maslar
    I'm dynamically adding a Boolean column to a DataSet. The DataSet's table is the DataSource for a GridView, which AutoGenerates the columns. Issue: The checkboxes for this dynamically generated column are all disabled. How can I enable them? ds.Tables["Transactions"].Columns.Add("Retry", typeof(System.Boolean)); ds.Tables["Transactions"].Columns["Retry"].ReadOnly = false; In other words, how can I control how GridView generates the CheckBoxes for a Boolean field? (And why does setting ReadOnly to False have no effect?) Thanks!

    Read the article

  • ItemStyle-VerticalAlign="Middle" not work in asp:GridView

    - by pablogrind
    Why ItemStyle-VerticalAlign="Middle" not work in asp:GridView?, this is my code <asp:GridView ID="GridView1" runat="server" RowStyle-VerticalAlign="Middle" > <Columns> <asp:TemplateField ItemStyle-VerticalAlign="Middle" HeaderText='<%$ Resources:Language, Admin_Employee_TimeTracker_GV_Code %>'> <ItemTemplate> <asp:TextBox id="txtReferenceCode" runat="server" text='<%# Bind("referenceCode")%>' MaxLength="100" Width="100px"></asp:TextBox> </ItemTemplate> <ItemStyle VerticalAlign="Middle" /> </asp:TemplateField>

    Read the article

  • can't see the result after i update a row in a table in a gridview

    - by aleo
    Peace! i created a gridview and ive bended the data using a ObjectDataSource, for some reasons i created the CRUD methods to do the work instead of using the CRUD method generated by the LINQDataSource; everything is just working fine but the update method, when i update a row in my gridview everything become as if there isnt any update! but when i check the database i can see that the rows is been updated! i can't find a solution (yet) to this issue. i'am using the updatepanel to have the autopostback without refreshing the page. thank you

    Read the article

  • GridView take a Row

    - by GIbboK
    Hi I use asp.net 4 and c#. I have a GridView, I would like take a Row when in Edit Mode in my code and find a control. Here my code, but does not work, it takes only the first row for the GridView. Any ideas? protected void uxManageSlotsDisplayer_RowDataBound(object sender, GridViewRowEventArgs e) { switch (e.Row.RowType) { case DataControlRowType.DataRow: // Take Row in Edit Mode DOES NOT WORK PROEPRLY if (e.RowState == DataControlRowState.Edit) { Label myTest = (Label)e.Row.FindControl("uxTest"); } break; }

    Read the article

  • asp.net checkbox in gridview - checked property is missing

    - by Peter PitLock
    In this asp.net gridview control, the checked property is always missing. I need to access the checked property via jquery Gridview source: <Columns> <asp:TemplateField> <ItemTemplate> <asp:CheckBox ID="chkSelected" runat="server" class="chkSummarySelection" /> </ItemTemplate> </asp:TemplateField> </Columns> Renders as : <input type="checkbox" name="ctl00$ContentPlaceHolder1$gv$ctl02$SelectedCheckBox" id="ctl00_ContentPlaceHolder1_gv_ctl02_SelectedCheckBox"> There is no checked property to access. I have tried $(".chkSummarySelection").click(function () { var chk; chk = $(this).prop("checked"); chk = $(this).attr("checked"); chk = $(this).is(":checked"); chk = $(this).attr("value"); chk = $(this).val(); chk = jQuery(this).is(':checked'); }); but nothing is working

    Read the article

  • Setting id to a panel control in gridview

    - by mariki
    I have a panel control in gridview's template. I need to hide/unhide panel in javascript function, for that i need to pass panel's id to the javascript. The problem is that all panels have the same id in gridview, so I need to set unique id to each panel. I tried to do: <asp:Panel id= "Panel_<%# Eval("ID")%>" and some other variations but always get an error. The panel contains some other controls, I need it to be server side because I need to set at code-behind (after checking if user is authenticated) What can I do? p.s. It doesn't have to be Panel, any other control that I can find with Findcontrol and can hold other controls.

    Read the article

  • Applying styles to a GridView matching certain criteria

    - by NickK
    Hi everyone. I'm fairly new to ASP.Net so it's probably just me being a bit stupid, but I just can't figure out why this isn't working. Basically, I have a GridView control (GridView1) on a page which is reading from a database. I already have a CSS style applied to the GridView and all I want to do is change the background image applied in the style depending on if a certain cell has data in it or not. The way I'm trying to handle this change is updating the CSS class applied to each row through C#. I have the code below doing this: protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { GridViewRow row = e.Row; string s = row.Cells[7].Text; if (s.Length > 0) { row.CssClass = "newRowBackground"; } else { row.CssClass = "oldRowBackground"; } } In theory, the data from Cell[7] will either be null or be a string (in this case, likely a person's name). The problem is that when the page loads, every row in the GridView has the new style applied to it, whether it's empty or not. However, when I change it to use hard coded examples, it works fine. So for example, the below would work exactly how I want it to: protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { GridViewRow row = e.Row; string s = row.Cells[7].Text; if (s == "Smith") //Matching a name in one of the rows { row.CssClass = "newRowBackground"; } else { row.CssClass = "oldRowBackground"; } } It seems as if the top piece of code is always returning the string with a value greater than 0, but when I check the database the fields are all null (except for my test record of "Smith"). I'm probably doing something very simple that's wrong here, but I can't see what. Like I said, I'm still very new to this. One thing I have tried is changing the argument in the if statement to things like: if (s != null), if (s != "") and if (s == string.empty) all with no luck. Any help is greatly appreciated and don't hesitate to tell me if I'm just being stupid here. :)

    Read the article

  • A gridview for debugging collections?

    - by Llewellyn
    Hi Guys, I'm working with fairly large generic collections and I need a quick way to view all the items and their properties in these collections while debugging. When I say view all the items, I mean I would like to view the collection as if it was bound to say.. a gridview. That was I could see all all the item properties listed. Currently VS2010 displays the collection object during debugging, but it takes several clicks before I can view any item's properties within the collection. As I'm using collection with 50 to 100 items in them, I've having a hard time getting a feel for the collection data because of having to click through to view each individual item's properties during debugging. Do you have any ideas or know of a visual studio plugin that can help display collections in a table format or gridview format? Thanks for you time

    Read the article

  • Ajax and gridviews

    - by Dofs
    Hi, can any of you recommend a good ajax gridview for asp.net? I have looked at telriks, but 1000$ is a bit too expansive for my taste. I don't need a whole lot of features, but rather it to be fast.

    Read the article

  • To change the text of LinkButton in EditItemTemplate

    - by Nandini
    Hi, I have a table from which i am getting my data to the GRidview control.I need to Insert Or Update this row to another table, according to some condition.If one condition is true, i need to change the text of the linkbutton in edititemtemplate to insert,else to update itself.How can i change the text of linkbutton in rowcommand? Please Help

    Read the article

  • css problem in top:??

    - by user175084
    i have to fix the header in a gridview and i use this in style Class <style type="text/css"> .gridFixedHeader { background-color:white; position:relative; top:expression(GridView1.offsetParent.scrollTop-2); } </style> but i get an error that expression(GridView1.offsetParent.scrollTop-2);is not valid... what all do i need to do to make this work..... any suggestions

    Read the article

  • Clear the data from the control after the insert the row?

    - by kathy
    Hi,, I'm using aspxgridview and after adding operation by using RowInserting event and I don't use the gridView.CancelEdit(); becuase I need the addform still apperaing to insert another row. My problem is : how can I clean the data from the control in the addform until I can insert the new data for the second row ?? thanks

    Read the article

  • Type '_Default' already contains a definition

    - by salvationishere
    I am developing a C# VS 2008 / SQL Server 2008 website. I have a Gridview. I included the Default.aspx and aspx.cs files below. But when I build this I get the below error: The Type '_Default' already contains a definition for 'btnOWrite' What do I need to do to fix this? I am not getting any errors now; just that this grid does not show up. Thanks! ASPX file: <%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %> <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server"> <asp:Panel runat="server" ID="AuthenticatedMessagePanel"> <asp:Label runat="server" ID="WelcomeBackMessage"></asp:Label> <table> <tr> <td> <asp:Label ID="tableLabel" runat="server" Font-Bold="True" Text="Select target table:"></asp:Label> </td> <td> <asp:Label ID="inputLabel" runat="server" Font-Bold="True" Text="Select input file:"></asp:Label> </td> </tr> <tr> <td valign="top"> <asp:Label ID="feedbackLabel" runat="server"></asp:Label> <asp:SqlDataSource ID="SelectTables" runat="server" ConnectionString="<%$ ConnectionStrings:AdventureWorks3_SelectTables %>" SelectCommand="getTableNames" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:QueryStringParameter DefaultValue="Person" Name="SchemaName" QueryStringField="SchemaName" Type="String" /> </SelectParameters> </asp:SqlDataSource> <asp:GridView ID="GridView1" DataSourceID="SelectTables" runat="server" Style="width: 400px;" CellPadding="4" ForeColor="#333333" GridLines="None" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" AutoGenerateSelectButton="True" DataKeyNames="TABLE_NAME"> <RowStyle BackColor="#F7F6F3" ForeColor="#333333" /> <Columns> <asp:BoundField HeaderText="TABLE_NAME" DataField="TABLE_NAME" /> </Columns> <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /> <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /> <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <EditRowStyle BackColor="#999999" /> <AlternatingRowStyle BackColor="White" ForeColor="#284775" /> </asp:GridView> </td> <td valign="top"> <input id="uploadFile" type="file" size="26" runat="server" name="uploadFile" title="UploadFile" class="greybar" enableviewstate="True" /> </td> </tr> </table> <table> <tr> <td style="width:150px; height:50px"></td> <td valign="bottom" style="width:150px; height:50px"> <input id="btnOWrite" type="submit" value="Overwrite Data" runat="server" class="greybar" onserverclick="btnOWrite_Click" name="btnOWrite" />&nbsp; </td> <td style="width:100px"></td> <td valign="bottom" style="width:150px; height:50px"> <input id="btnAppend" type="submit" value="Append Data" runat="server" class="greybar" onserverclick="btnAppend_Click" name="btnAppend" /> </td> </tr> </table> </asp:Panel> <asp:Panel runat="Server" ID="AnonymousMessagePanel"> <asp:HyperLink runat="server" ID="lnkLogin" Text="Log In" NavigateUrl="~/Login.aspx"> </asp:HyperLink> </asp:Panel> </asp:Content> ASPX.CS file: using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Collections.Generic; using System.IO; using System.Drawing; using System.ComponentModel; using System.Data.SqlClient; using ADONET_namespace; using System.Security.Principal; //using System.Windows; public partial class _Default : System.Web.UI.Page //namespace AddFileToSQL { //protected System.Web.UI.HtmlControls.HtmlInputFile uploadFile; protected System.Web.UI.HtmlControls.HtmlInputButton btnOWrite; protected System.Web.UI.HtmlControls.HtmlInputButton btnAppend; protected System.Web.UI.WebControls.Label Label1; protected static string inputfile = ""; public static string targettable; public static string selection; // Number of controls added to view state protected int default_NumberOfControls { get { if (ViewState["default_NumberOfControls"] != null) { return (int)ViewState["default_NumberOfControls"]; } else { return 0; } } set { ViewState["default_NumberOfControls"] = value; } } protected void uploadFile_onclick(object sender, EventArgs e) { } protected void Load_GridData() { //GridView1.DataSource = ADONET_methods.DisplaySchemaTables(); //GridView1.DataBind(); } protected void btnOWrite_Click(object sender, EventArgs e) { if (uploadFile.PostedFile.ContentLength > 0) { feedbackLabel.Text = "You do not have sufficient access to overwrite table records."; } else { feedbackLabel.Text = "This file does not contain any data."; } } protected void btnAppend_Click(object sender, EventArgs e) { string fullpath = Page.Request.PhysicalApplicationPath; string path = uploadFile.PostedFile.FileName; if (File.Exists(path)) { // Create a file to write to. try { StreamReader sr = new StreamReader(path); string s = ""; while (sr.Peek() > 0) s = sr.ReadLine(); sr.Close(); } catch (IOException exc) { Console.WriteLine(exc.Message + "Cannot open file."); return; } } if (uploadFile.PostedFile.ContentLength > 0) { inputfile = System.IO.File.ReadAllText(path); Session["Message"] = inputfile; Response.Redirect("DataMatch.aspx"); } else { feedbackLabel.Text = "This file does not contain any data."; } } protected void Page_Load(object sender, EventArgs e) { if (Request.IsAuthenticated) { WelcomeBackMessage.Text = "Welcome back, " + User.Identity.Name + "!"; // Reference the CustomPrincipal / CustomIdentity CustomIdentity ident = User.Identity as CustomIdentity; if (ident != null) WelcomeBackMessage.Text += string.Format(" You are the {0} of {1}.", ident.Title, ident.CompanyName); AuthenticatedMessagePanel.Visible = true; AnonymousMessagePanel.Visible = false; if (!Page.IsPostBack) { Load_GridData(); } } else { AuthenticatedMessagePanel.Visible = false; AnonymousMessagePanel.Visible = true; } } protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { GridViewRow row = GridView1.SelectedRow; targettable = row.Cells[2].Text; } }

    Read the article

  • How to display table in ASP.NET website?

    - by salvationishere
    I am developing a C# VS 2008 / SQL Server 2008 website, but now I cannot display the Gridview containing my table. I included the Default.aspx and aspx.cs files below. What do I need to do to fix this? I am not getting any errors now; just that this grid does not show up. Thanks! ASPX file: <%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %> <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server"> <asp:Panel runat="server" ID="AuthenticatedMessagePanel"> <asp:Label runat="server" ID="WelcomeBackMessage"></asp:Label> <table> <tr > <td> <asp:Label ID="tableLabel" runat="server" Font-Bold="True" Text="Select target table:"></asp:Label> </td> <td> <asp:Label ID="inputLabel" runat="server" Font-Bold="True" Text="Select input file:"></asp:Label> </td></tr> <tr><td valign="top"> <asp:Label ID="feedbackLabel" runat="server"></asp:Label> <asp:SqlDataSource ID="SelectTables" runat="server" ConnectionString="<%$ ConnectionStrings:AdventureWorks3_SelectTables %>" SelectCommand="SELECT TABLE_NAME FROM information_schema.Tables WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA = @SchemaName"> <SelectParameters> <asp:Parameter Name="SchemaName" Type="String" DefaultValue="" /> </SelectParameters> <InsertParameters> <asp:Parameter Name="TABLE_NAME" Direction="Output" Type="String" DefaultValue="" /> </InsertParameters> </asp:SqlDataSource> <asp:GridView ID="GridView1" DatasourceID="SelectTables" runat="server" style="WIDTH: 400px;" CellPadding="4" ForeColor="#333333" GridLines="None" onselectedindexchanged="GridView1_SelectedIndexChanged" AutoGenerateSelectButton="True" DataKeyNames="TABLE_NAME"> <RowStyle BackColor="#F7F6F3" ForeColor="#333333" /> <Columns> <asp:BoundField HeaderText="TABLE_NAME" DataField="TABLE_NAME" /> </Columns> <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /> <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /> <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <EditRowStyle BackColor="#999999" /> <AlternatingRowStyle BackColor="White" ForeColor="#284775" /> </asp:GridView> </td> <td valign="top"> <input id="uploadFile" type="file" size="26" runat="server" name="uploadFile" title="UploadFile" class="greybar" enableviewstate="True" /> </td></tr> </table> </asp:Panel> <asp:Panel runat="Server" ID="AnonymousMessagePanel"> <asp:HyperLink runat="server" ID="lnkLogin" Text="Log In" NavigateUrl="~/Login.aspx"> </asp:HyperLink> </asp:Panel> </asp:Content> ASPX.CS file: using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Collections.Generic; using System.IO; using System.Drawing; using System.ComponentModel; using System.Data.SqlClient; using ADONET_namespace; using System.Security.Principal; //using System.Windows; public partial class _Default : System.Web.UI.Page //namespace AddFileToSQL { //protected System.Web.UI.HtmlControls.HtmlInputFile uploadFile; protected System.Web.UI.HtmlControls.HtmlInputButton btnOWrite; protected System.Web.UI.HtmlControls.HtmlInputButton btnAppend; protected System.Web.UI.WebControls.Label Label1; protected static string inputfile = ""; public static string targettable; public static string selection; // Number of controls added to view state protected int default_NumberOfControls { get { if (ViewState["default_NumberOfControls"] != null) { return (int)ViewState["default_NumberOfControls"]; } else { return 0; } } set { ViewState["default_NumberOfControls"] = value; } } protected void uploadFile_onclick(object sender, EventArgs e) { } protected void Load_GridData() { //GridView1.DataSource = ADONET_methods.DisplaySchemaTables(); //GridView1.DataBind(); } protected void btnOWrite_Click(object sender, EventArgs e) { if (uploadFile.PostedFile.ContentLength > 0) { feedbackLabel.Text = "You do not have sufficient access to overwrite table records."; } else { feedbackLabel.Text = "This file does not contain any data."; } } protected void btnAppend_Click(object sender, EventArgs e) { string fullpath = Page.Request.PhysicalApplicationPath; string path = uploadFile.PostedFile.FileName; if (File.Exists(path)) { // Create a file to write to. try { StreamReader sr = new StreamReader(path); string s = ""; while (sr.Peek() > 0) s = sr.ReadLine(); sr.Close(); } catch (IOException exc) { Console.WriteLine(exc.Message + "Cannot open file."); return; } } if (uploadFile.PostedFile.ContentLength > 0) { inputfile = System.IO.File.ReadAllText(path); Session["Message"] = inputfile; Response.Redirect("DataMatch.aspx"); } else { feedbackLabel.Text = "This file does not contain any data."; } } protected void Page_Load(object sender, EventArgs e) { if (Request.IsAuthenticated) { WelcomeBackMessage.Text = "Welcome back, " + User.Identity.Name + "!"; // Reference the CustomPrincipal / CustomIdentity CustomIdentity ident = User.Identity as CustomIdentity; if (ident != null) WelcomeBackMessage.Text += string.Format(" You are the {0} of {1}.", ident.Title, ident.CompanyName); AuthenticatedMessagePanel.Visible = true; AnonymousMessagePanel.Visible = false; if (!Page.IsPostBack) { Load_GridData(); } } else { AuthenticatedMessagePanel.Visible = false; AnonymousMessagePanel.Visible = true; } } protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { GridViewRow row = GridView1.SelectedRow; targettable = row.Cells[2].Text; } }

    Read the article

  • How to apply filters to agridview like applying filters to excel sheet

    - by joy
    hi i am doing an application where i am populating the grid from databse by passsing different parameters to the stored procedure and getting data to a datatable and binding it to the grid view. now i need to have filters applied to the grid so that it should just work like the filters applied to a excel sheet. can i have some piece of code for applying filters to the gridview with out changing the design of the grid

    Read the article

  • Add new row to asp .net grid view using button

    - by SARAVAN
    Hi, I am working in ASP .net 2.0. I am a learner. I have a grid view which has a button in it. Please find the asp mark up below <form id="form1" runat="server"> <div> <asp:GridView ID="myGridView" runat="server"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:Button CommandName="AddARowBelow" Text="Add A Row Below" runat="server" /> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> </div> </form> Please find the code behind below. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Data; using System.Web.UI.WebControls; namespace GridViewDemo { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { DataTable dt = new DataTable("myTable"); dt.Columns.Add("col1"); dt.Columns.Add("col2"); dt.Columns.Add("col3"); dt.Rows.Add(1, 2, 3); dt.Rows.Add(1, 2, 3); dt.Rows.Add(1, 2, 3); dt.Rows.Add(1, 2, 3); dt.Rows.Add(1, 2, 3); myGridView.DataSource = dt; myGridView.DataBind(); } protected void myGridView_RowCommand(object sender, GridViewCommandEventArgs e) { } } } I was thinking that when I click the command button, it would fire the mygridview_rowcommand() but instead it threw an error as follows: Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" % in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. Can any one let me know on where I am going wrong?

    Read the article

  • ASP.NET ObjectDataSource Sorting Twice

    - by user204588
    Hello, I'm working with some existing code uses an objectDataSource and that calls a sort method inside a DLL that I don't have access to. I'm trying to add a custom field to sort and I basically want to re-sort after the initial sort. I don't know if this can be done but before the GridView is displayed, I need to intercept the code and sort the way I want to sort. Any ideas? I'm lost.

    Read the article

< Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >