ASP Gridviews in Sharepoint Visual WebPart

Hi all, 
  I have developed a grid view in sharepoint visual webpart using asp.net grid view. In that grid view I have footer row ,in footer row i have one drop down list ,label,one text box etc... 
  When even I am changing the drop down It needs to post back and get some value and assigned to label. this is working fine but when  there are no rows in grid view at that time while changing drop down list I am getting one empty row in  grid
view for that one of my colleague suggested that keep a update panel for both drop down and label . I kept and working fine but when I am trying to insert a row from footer with out any data selection again I am getting am empty row in grid view
  Could you    please any help me out from this error
Thanks & Regards,
Nag

Hi Vivek,
  I am using that code logic  previously, when I am opening very first time it is showing "No Results found" text  but in my Case there is a drop down list in footer that needs to  the data from server so "autopost back"
property is true for drop down list
   While I am changing drop down the grid view automatically adding an empty row without showing any text and also it is showing edit and delete button.
    Please  Help me.
Thanks & Regards,
Nag

Similar Messages

  • Perform CRUD operation on List using Gridview control (SharePoint Visual webpart)

    Hi Friends,
    I have SharePoint Visual webpart and I want to perform CRUD operation on SharePoint list using Gridview control.
    Is there any other way to implement it , please suggest me the solution approach.
    Thanks,
    Digambar Kashid

    Is there any specific reason you dont want to use Out Of the Box list CRUD operation? Anyways, if you want to use custom approach I think SPGridView is good approach. 
    There are some samples available for what you are trying to achieve.
    Samples on how to use SharePoint's GridView
    Also There is similar thread which might be helpful as well. 
    http://social.msdn.microsoft.com/Forums/en-US/7b4f69e9-36b5-4188-8b75-1f727d0bb594/is-there-any-posibility-to-do-crud-operations-with-gridview-control?forum=sharepointdevelopmentprevious
    Amit

  • PAging in Asp Repeater control in Visual Webpart

    hi
    i am trying to create a visual webpart in which i am getting 100 items from the list and showing it on to the page using ASP:Repeater control now i've to apply paging on the Repeater control,can anyone tell me how do i apply paging in Asp.Net Repeater control. 

    Hi,
    There's no built-in pagination in the Repeater control, you can achieve pagination in the Repeater control by creating another Repeater control for pages and use PagedDataSource as it's source.
    Here is a blog with the code for your reference:
    Repeater control with paging in share point 2010 using c#
    http://sharepointdotnetfalls.blogspot.com/2013/07/repeater-control-with-paging-in-share.html
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Auto Populate Textbox in sharepoint Visual Webpart

    Hi all,
        I have requirement in My organization. all the web users need to be auto populating while typing letters.
       I have done this earlier in .net with web method  but web method scenario  is not working in visual webpart
     Can any one help me out ....
    Thanks 
    Nag

    Hi Nag,
    From your description, my understanding is that you want to ac auto populate/suggest  all the users from current web  in textbox  in visual webpart.
    You could use jQuery to AutoComplete text box in SharePoint 2010 Visual Web part. Please refer to this article(you need to replace the data source ”availableTags”
    in the demo):
    http://sharepointwings.blogspot.in/2012/05/autocomplete-textbox-using-jquery-in.html
    Please refer to this article about how to add jQuery to SharePoint Visual Web part:
    http://sharepointdragons.com/2012/04/18/adding-jquery-to-a-visual-web-part-and-then-implement-parentchild-radio-buttons/
    Best Regards,
    Vincent Han
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Visual webpart gridview control Export to Excel

    Hi,
    I am trying to implement export to excel using visual webpart, first I got the error put "I am getting error on
    GridView1.RenderControl(htw); line and the error is Control 'ctl00_ContentPlaceHolder1_GridView1' of type 'GridView' must be placed inside a form tag with runat=server. ",And when I am using
    public override void
    VerifyRenderingInServerForm(Control control)
      /* Confirms that an HtmlForm control is rendered for the specified ASP.NET
         server control at run time. */
    I am getting error that it cannot be overridden .How to resolve this issue

    Hi,
    If you want to export gridview to Excel in visual web part, I suggest you refer to the following articles to achieve it.
    ASP.Net 2.0: Export GridView to Excel
    http://www.c-sharpcorner.com/UploadFile/DipalChoksi/exportxl_asp2_dc11032006003657AM/exportxl_asp2_dc.aspx
    Export Gridview to Excel in Sharepoint (ascx) 
    http://forums.asp.net/t/1461411.aspx?Export+Gridview+to+Excel+in+Sharepoint+ascx+Export
    to Excel - From SharePoint user control based web part
    http://www.sharepointdiary.com/2011/02/export-to-excel-from-sharepoint-user-control-webpart.html
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Sharepoint 2010 Custom Visual Webpart button click event firing on page refresh

    I have developed a Visual Webpart to create a list in SP using vs2010 and  the button click event I have written the list create method. If I click the button list is created successfully.  And I refresh the page again list is creating(Again button
    click event is triggering).please help me to solve the issue.
     protected void Button1_Click(object sender,
    EventArgs e)
                SPWeb web
    = SPContext.Current.Web;
                //SPList list=web.Lists["Auto"];
                SPList list
    = web.Lists[DropDownList2.SelectedItem.Text];
                if
    (string.IsNullOrEmpty(TextBox1.Text)
    || string.IsNullOrEmpty(DropDownList1.Text))
    Label4.Text =
    "Fields Are Empty";
                else
    if (DropDownList1.SelectedItem.Text
    == "Single line of Text")
                    list.Fields.Add(TextBox1.Text,
    SPFieldType.Text,
    true);
    SPView viewname = list.Views["All Items"];
                    viewname.ViewFields.Add(TextBox1.Text);
    //viewname.Update();
                    list.Update();
    Label4.Text =
    "Field Created Successfully";
    TextBox1.Text =
    string.Empty;
    // Label4.Text = string.Empty;

    Hi,
    This is because the request is sent to the server when you refresh the page.
    A workaround for this is that we can “provide a refresh link that redirects to the same page (or if you have some action causing the refresh programmatically, you could just
    redirect to the page after that, with Response.Redirect)
    so that page is requested by the browser (with GET method, default with hyperlinks)”.
    More information:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/45648b39-1229-405c-ac9e-60eb82905982/click-event-getting-fired-on-page-refresh
    Or we can use the Session to save a value which used as a flag for us to check whether it is a page refresh and perform accordingly.
    http://www.codeproject.com/Articles/28099/Refresh-Page-Issue-in-ASP-Net
    http://www.codeproject.com/Articles/10240/Detecting-Page-Refresh
    Thanks
    Patrick Liang
    TechNet Community Support

  • Could not load file or assembly AjaxToolkit error in SharePoint 2013 Visual Webpart

    I wanted to use ajax controls in visual webpart for sharepoint 2013 so i followed steps.
    1-I cut this snippet (see below) from <head></head> Section and paste in <body></body> Section for my master page since it's a requirement for SharePoint 2013 ajax functionality.
    Snippet:
    <!--MS:<SharePoint:AjaxDelta id="DeltaSPWebPartManager" runat="server">-->
    <!--MS:<WebPartPages:SPWebPartManager runat="server">-->
    <!--ME:</WebPartPages:SPWebPartManager>-->
    <!--ME:</SharePoint:AjaxDelta>-->
    2-downloaded a latest ajax tool kit and then added ajax toolkit dll from the toolkit library in my solution's bin-->debug folder
    now add ajax entries in web.config in these sections
    in <SafeControls>
          <SafeControl Assembly="ajaxcontroltoolkit, Version=4.1.7.1213, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e, processorArchitecture=MSIL" Namespace="AjaxControlToolkit" TypeName="*" />
    in <assemblies>
    <add assembly="AjaxControlToolkit, Version=4.1.7.1213, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" />
    in <controls>
    <add tagPrefix="ajax" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit, Version=4.1.7.1213, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" />
    finally registered ajax in visual web part as 
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxtoolkit" %>
    added following calender control
    <asp:TextBox MaxLength="10" ID="txtToDate" runat="server" CssClass="FormTextBoxSmall"></asp:TextBox>
    <asp:ImageButton ID="calReqDateTo" runat="server" ImageUrl="" />
    <ajaxtoolkit:CalendarExtender id="CalendarExtender2" runat="server" targetcontrolid="txtToDate"
        format="dd/MM/yyyy" popupbuttonid="calReqDateTo" />
    reset iis and deployed my solution but when i deployed it throws error 
    "could not load file or assembly AjaxToolkit,Version=4.1.7.1213 "
    please help

    Hi,
    In this below thread they have discussed and resolved your issue.
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/60fa19fe-86a0-446b-b61f-11a82fe4287f/how-to-implement-ajax-toolkit-for-sharepoint2013?forum=sharepointdevelopment&prof=required
    Please let us know if you need further details
    Sekar - Our life is short, so help others to grow
    Whenever you see a reply and if you think is helpful, click "Vote As Helpful"! And whenever
    you see a reply being an answer to the question of the thread, click "Mark As Answer

  • Asynchronous visual webpart for SharePoint 2013

    HI,
    How to create asynchronous visual webparts in SharePoint 2013 (VS 2012) . I can see lot of examples for 2010 version, but not for SP 2013.
    I have 2 visual webparts, which I want to make it as a asynchronous webpart. One webpart has the code written in Javascript client object model(loads lot of images), another is a server side webpart which has a SPGridview.
    Is there any sample code available for SP 2013?
    Thanks

    Hi,
    Please try to convert the SharePoint 2010 project to SharePoint 2013.
    http://sadomovalex.blogspot.kr/2013/02/convert-visual-studio-sharepoint-2010.html
    In SharePoint 2013, we can create a visual web part, then we can use jQuery Ajax and REST API to achieve asynchronous data loading.
    More information:
    http://www.dotnetcurry.com/showarticle.aspx?ID=1009
    http://asyncwebpartframewrk.codeplex.com/releases/view/52459
    Thanks,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Dennis Guo
    TechNet Community Support

  • SharePoint DatePicker is not working in Visual webpart

    Hi,
    The sharepoint date picker is not working for Visual webparts created in VS 2012 (SP 2013).
    In my visual webpart, I added the form digest, and then the sharePoint date control.
    <script type="text/javascript" src="/_layouts/15/datepicker.js"></script>
    <SharePoint:DateTimeControl ID="dtDate" runat="server" DateOnly="true" />
    I get the "/ error in Application". Many websites are saying to add the below line to the datepicker:
    <SharePoint:DateTimeControl ID="dtDate" runat="server"
    DateOnly="true" DatePickerFrameUrl="<%
    $SPUrl:~sitecollection/_layouts/15/iframe.aspx %>" />
    But adding the "DatePickerFrameUrl" gives error in the "InitializeControl()" method available in OnInit().
    Error: The name InitializeControl does not exist in the current context.
    I have checked this:
    http://developmentsimplyput.blogspot.in/2013/04/sharepoint-datetimecontrol-issue-when.html
    http://sharepoint.stackexchange.com/questions/57092/sharepointdatetimecontrol-crashes-in-sp2013-webpart
    but did not solve the issue. Also creating a root site for just a DatePicker control is not an option for me.
    Has anybody found a solution to this?
    How to use the SharePoint datepicker in visual webpart for SP 2013?
    Thanks

    hi
    did you try to investigate the initial error more deeply, e.g. check stack trace in the logs? In our case it worked quite straightforward (but it was in SP2010) by adding the following control on ascx control:
    <SharePoint:DateTimeControl ID="Foo" OnDateChanged="StartTimeChanged" HoursMode24="true" FirstDayOfWeek="1" AutoPostBack="true" runat="server" />
    If it is problematic to check logs, you may create custom control which inherits OTB DateTimeControl, override appropriate methods in it and then check the error in debugger:
    public class MyDateTimeControl : DateTimeControl
    Blog - http://sadomovalex.blogspot.com
    Dynamic CAML queries via C# - http://camlex.codeplex.com

  • SharePoint 2010 Query string parameter pass between visual webparts

    Hi
    I should pass a query string value from one visual webpart to another visual webpart in SharePoint 2010 .
    Could you please help me like how we can pass
    Thanks
    Siddartha

    In the webpart you can add the code like "Response.Redirect("Page2.aspx?CustomerID=326");"
    Once you develop the webparts, add them to the respective pages based on your required functionality.
    Please check the similar thread
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/3099100f-72b2-4850-ba50-1e02416e9d9c/passing-query-string-between-two-webparts-usercontrols?forum=sharepointdevelopmentlegacy
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

  • SharePoint 2013 Query string parameter pass between visual webparts

    Hi,
    I have created one web part called Latest News in SharePoint 2013 which is
    visual web part(Sandbox Solution).
    In that, there is button called "Read More". Now when I click on that button I want to show only that item in the new page which is clicked using query string. but the data which will be shown after Read More button will be coming
    from a different Visual Web Part.
    How should I pass a query string value from one visual webpart to another visual webpart in SharePoint 2013 ?
    Could anyone please help me like how we can pass.
    Thanks in Advance.

    Hi,
    To pass information from one web part to another, we can use the consumer and provider web part with the
    IWebPartParameters interface.
    There are some articles about this topic, you can refer to them.
    http://msdn.microsoft.com/en-us/library/office/ms469765(v=office.14).aspx
    http://www.c-sharpcorner.com/UploadFile/40e97e/sharepoint-2010-connected-web-parts/
    http://underthehood.ironworks.com/2011/03/how-to-build-a-consumer-web-part-in-sharepoint-2010-using-iwebpartparameters-that-works-with-html-fo.html
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • How to use sharepoint CSS in asp:gridview

    Hello
    How can I implement sharepoint css (blueone) with asp:gridview for header, footer, rowtemplate etc?
    Avi

    Hi, Avikumar
              Developer Toolbar is a recommended tool for UI and CSS design, also  you can check this for moss css style
              http://www.heathersolomon.com/content/sp07cssreference.htm
              And for displaying data with SharePoint style, you can use SPGridView instead of gridview. The SPGridView control provides a great alternative for displaying tabular data in SharePoint-based solutions.
              Here are some links for this:
              http://msdn.microsoft.com/en-us/library/bb466219.aspx
              http://blogs.msdn.com/powlo/archive/2007/02/25/displaying-custom-data-through-sharepoint-lists-using-spgridview-and-spmenufield.aspx
              Hope this can help.     
     Best Regards,
    -Aaron

  • How to use existing SharePoint Data Source in Visual WebPart in Visual Studio

    I want to create a SharePoint Visual Web Part using Visual Studio, which will query SQL database and will display some data (e.g. Latest News from Database)
    I already have a SQL Data Source (rsds file) in SharePoint. Can i use this rsds to connect SQL database for my Visual Web Part ?

    I will use web.config as last option but can you please explain how BdcService will connect external SQL database.
    What if I use SharePoint property to store connectivity information and all web parts will use it to make connection string?
    Following code returns 0 entities
    // Get reference to BDC Service
    BdcService service =
    SPFarm.Local.Services.GetValue<BdcService>();
    // Get MetaData Catalog
    IMetadataCatalog catalog = service.GetDatabaseBackedMetadataCatalog(SPServiceContext.Current);
    // Some heading for the literal control
    string dbData =
    "<h1>Lob Systems and Entities … </h1> " +
    "</br>";
    // Get all the external content types from the meta data catalog
    foreach (IEntity
    ect in catalog.GetEntities("*"))
    // Add external content type’s name and lob system name to the literal control
    dbData += ect.Name +
    "," + ect.GetLobSystem().Name +
    "</br>";
    ltMsg.Text = dbData;

  • Client Object Model in Visual Webpart

    Hi
    I am new to Client Object Model.I've to create a visual web part in SharePoint 2013 via Client Object Model using
    SandBoxed solution.
    i did following.
    1-Created empty sharepoint project
    2-added two dlls for Client Object Model in the project
    Microsoft.SharePoint.Client
    Microsoft.SharePoint.Client.Runtime
    3-in the visual webpart .ascx file i just created asp label as  below
    <asp:Label ID="label1" runat="server"></asp:Label>
    4- in the visual webpart .cs file i write a client object model code to show title items in the label from the "Test" list as below.
    5-when i deploy the code it deploys successfully,but when i try to insert this web-part on to the page it shows errors
    as below.
    Please tell me what am i doing wrong.Urgent help required.

    Yes,deployed as sandbox solution.Actually i want to create a visual webpart in Sharepoint 2013 using Client Object Model. How can i do this,i followed below steps.
    1-Created empty sharepoint project
    2-added two dlls for Client Object Model in the project
    Microsoft.SharePoint.Client
    Microsoft.SharePoint.Client.Runtime
    3-in the visual webpart .ascx file i just created asp label as  below
    <asp:Label ID="label1" runat="server"></asp:Label>
    4- in the visual webpart .cs file i write a client object model code to show title items in the label from the "Test" list as below.
    using Microsoft.SharePoint.Client;
    using System;
    using System.ComponentModel;
    using System.Web.UI.WebControls.WebParts;
    namespace SharePointProject2.VisualWebPart1
        [ToolboxItemAttribute(false)]
        public partial class VisualWebPart1 : WebPart
            // Uncomment the following SecurityPermission attribute only when doing Performance Profiling on a farm solution
            // using the Instrumentation method, and then remove the SecurityPermission attribute when the code is ready
            // for production. Because the SecurityPermission attribute bypasses the security check for callers of
            // your constructor, it's not recommended for production purposes.
            // [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Assert, UnmanagedCode = true)]
            public VisualWebPart1()
            protected override void OnInit(EventArgs e)
                base.OnInit(e);
                InitializeControl();
            protected void Page_Load(object sender, EventArgs e)
                ClientContext context = new ClientContext("http://spsiteURL");
                List testList = context.Web.Lists.GetByTitle("Test");
                CamlQuery query = CamlQuery.CreateAllItemsQuery(100);
                ListItemCollection items = testList.GetItems(query);
                context.Load(items);
                context.ExecuteQuery();
                foreach (ListItem listItem in items)
                    label1.Text = label1.Text + ", " + listItem["Title"];
    If this is not the correct way then how can i  use client object model to get sharepoint list items.Please mention.

  • Visual studio 2012 the name "initializeControl" does not exist in the namespace in visual WebPart

    Hi All,
    I'm trying to create a visual webpart in SharePoint 2013 using Visual Studio 2012 and I am seeing that the file ascx.g.cs
    is missing and i have this error in file ascx.cs : the name "initializeControl" does not exist in the namespace.
    And like i said i use VS2012 Ultimate
    Can anyone Help me please!!!
    thanks.

    In most scenarios this is caused by some error in code preventing Visual Studio from generating the designer file. You could try to undo the latest changes and see whether the item is being generated or not. Additionally you could try checking if the custom
    tool is still associated with the Visual Web Part SPI in the Properties Window.
    w: http://blog.mastykarz.nl | t:
    @waldekm | c: http://mavention.codeplex.com | c:
    http://mavention.nl

Maybe you are looking for

  • Ssrs 2008 r2 error-Forward pointing dependencies are not valid

    In an existing SSRS 2008 r2, report, I am attempting to add a parameter called 'Customer_Category'. I am getting the following error message: The report paramter 'CustomerNumber' has a DefaultValue or a ValidVaue that depends on the report parameter

  • Register 2 purchase contidions with different currency

    Hello All, In our project we are facing to a big issue with different currencies in the PO conditions. An example of the situation in the PO is the following (but should be different currencies, not always the same currency for the same condition):  

  • How to get timestamp in OEG filter ?

    Hi, may I have another question(sorry for pretty much of questions): In OEG, how could I get a timestamp(can OEG generate timestamp?) within OEG and assign its value into my SOAP message. Thank.... Cliff

  • Using windows7..I can not longer copy and paste, cut and paste. what happened?

    Using windows 7, on a Compaq Presario, for a time now, I am not able to cut and paste, or copy and paste. Used to work by right click, highlite copy, got to word page and paste. I cannot get right click to bring this box up. What is happening?

  • Re: Tempro is not working

    I have tried unsuccessfully to install Windows 7 SP1 on two different computers and aftera system restore to my T110 operating 64bit to get rid if it, I am now getting warnings on start up that Tempro isn't working, along with all the ancillary progr