Gridview

I have made a gridview which has to columns and a template field. I have binded data in gridview using datsource and databind. I want to add a Search option to the gridview through stored procedure only. How can I do that?

Hi Arpit Jain 09,
ASP.NET related questions should be post in
ASP.NET forums. You can receive more helpful responses there.
Thanks for your understanding.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Calculating the total of one column within a GridView

    Hello Everyone!
    I have created a Grid with 6 columns. The 6th column contains monetary values. I have set 'ShowFooter' to 'True' and have styled my footer however there is currently no data in the footer. What
    I'm looking to do is calculate the total of the 6th column and put the value within the footer at the bottom of the 6th column - I'm not sure how to go about this so any assistance would be much appreciated.
    Thank you

    Good morning Griffs, 
    Check this out...http://stackoverflow.com/questions/19808855/calculate-the-sum-of-gridview-column-data-and-store-its-value-in-a-variable
    Danny Rosales .NET Developer

  • How can I display a letter grade in my gridview after calculating percentage into a hidden field in Visual Studio?

    For school I am working on an app using C# in visual studio that allows a student to enter their name, the number of points they earned and the points possible. When they click a submit button, the grade percentage is calculated in a hidden field and then
    the percentage and letter grade should spit out into the gridview. THe issue I am having is trying to figure out how to translate within the if statements regarding the percentage amount equalling whatever letter grade, and then spit that letter grade out
    into the gridview. Here is the code I have so far:
            protected void btnSubmit_Click(object sender, EventArgs e)
                SqlStudent.Insert();
                hdnGradePercent.Value = (((int.Parse("txtPointsEarned.Text")) / (int.Parse("txt.PointsPoss.Text")) * 100)).ToString();
                if ((int.Parse(hdnGradePercent.Value) >= 0) & ((int.Parse(hdnGradePercent.Value) <= 59)))
    (this is where I am having trouble. I can't figure out how to get the letter grade and percent to spit out into the   gridview.)
                else if ((int.Parse(hdnGradePercent.Value) >= 60) & ((int.Parse(hdnGradePercent.Value) <= 69)))
                else if ((int.Parse(hdnGradePercent.Value) >= 70) & ((int.Parse(hdnGradePercent.Value) <= 79)))
                else if ((int.Parse(hdnGradePercent.Value) >= 80) & ((int.Parse(hdnGradePercent.Value) <= 89)))
                else if ((int.Parse(hdnGradePercent.Value) >= 90) & ((int.Parse(hdnGradePercent.Value) <= 100)))
    Any help would be greatly appreciated! I've been stuck on this for hours and I"m losing my mind!!

    Please post ASP.NET questions in the ASP.NET forums (http://forums.asp.net ).

  • How to restrict number of rows display using ig:gridView

    Hi
    All
    How to restrict number of rows display using <ig:gridView datasource="{mybean.mylist}">
    i am getting 10 rows using data_row . i wanna show only first 5 rows .
    pageSize ="5" will be ok . but it displays remaining rows in next page. but i want to display only first 5 rows . is there any attribute to restrict number of rows.
    thanks
    rambhapuri

    I have no idea which component you're talking about. If want to discuss here about a non-Sun JSF component, then please mention about the name, version and build in detail. You can also consider posting this question at the website/forum/mailinglist of the component manfacturer rather than here. At least I can tell you that the Sun JSF h:dataTable has the 'rows' attribute for that. I can also suggest you to just take a look in the TLD documentation of the component in question. There should be all possible attributes listed with a detailed explanation about the behaviour.

  • Want to fix four items per row in a gridview in Windows Phone 8.1 app. I am using data binding.

    No of items in a row of grid varies for different resolution WP devices. How can it be fix to say 4 items per row. Here is xaml:
    <DataTemplate x:Key="DataTemplate1">
    <Grid Margin="8,0">
    <Grid.RowDefinitions>
    <RowDefinition Height="Auto"/>
    <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <Border Background="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}" Margin="0,9.5,0,0">
    <Image x:Name="image" Height="100" Width="100" Source="{Binding ImageName}" >
    </Image>
    </Border>
    <TextBlock Grid.Row="1" Text="{Binding Name}" />
    </Grid>
    </DataTemplate>
    <Grid>
    <GridView ItemTemplate="{StaticResource DataTemplate1}" ItemsSource="{Binding Data1}" HorizontalAlignment="Center" >
    </GridView>
    </Grid>

    You could change the GridView's size to datatemplate size * 4 (and allow for any padding). This would have the side-effect of making the GridView a different size on different screens though (e.g. on a higher-resolution screen the grid will be smaller, but
    will have the correct number of rows).
    I'm not sure if it's possible, but see if you can adjust the datatemplate's size at runtime to be 1/4 the gridview size. This will scale nicely if it works.
    I'm a self-taught noob amateur. Please take this into account when responding to my posts or when taking advice from me.

  • Control 'ctl00_SPWebPartManager1_g_d4fb972b_26ec_4065_9c89_80b51b384492_gvwikireport' of type 'GridView' must be placed inside a form tag with runat=server.

    Hi,
    I have written code for 'Export To Excel' in the visual web part as below
    //ascx file    
    <table>
        <tr>
            <td>From Date:</td>
            <td><SharePoint:DateTimeControl ID="dtFromDate" runat="server" DateOnly="True" /></td>
        </tr>
        <tr>
            <td>To Date:</td>
            <td><SharePoint:DateTimeControl ID="dtToDate" runat="server" DateOnly="True" TimeOnly="False" /></td>
        </tr>
        <tr>
          <td>Report Type:<asp:DropDownList ID="ddlreporttype" runat="server"><asp:ListItem>Consolidated</asp:ListItem><asp:ListItem>Question Wise</asp:ListItem></asp:DropDownList></td>
            <td>
                <br />               
                <asp:GridView ID="gvwikireport" runat="server">
                </asp:GridView>                   
            </td>
        </tr>   
        <tr>
            <td><asp:Button ID="btnExportToExcel" runat="server" Text="Export To Excel" OnClick="btnExportToExcel_Click"/></td>
        </tr>  
        </table>
    //cs file
    protected void Page_Load(object sender, EventArgs e)
                if (!Page.IsPostBack)
                    BindGridview();
    private void BindGridview()
                DataTable dt = new DataTable();
                dt.Columns.Add("UserId", typeof(Int32));
                dt.Columns.Add("UserName", typeof(string));
                dt.Columns.Add("Education", typeof(string));
                dt.Columns.Add("Location", typeof(string));            
                dt.Rows.Add(1, "SureshDasari", "B.Tech", "Chennai");
                dt.Rows.Add(2, "MadhavSai", "MBA", "Nagpur");
                dt.Rows.Add(3, "MaheshDasari", "B.Tech", "Nuzividu");
                dt.Rows.Add(4, "Rohini", "MSC", "Chennai");
                dt.Rows.Add(5, "Mahendra", "CA", "Guntur");
                dt.Rows.Add(6, "Honey", "B.Tech", "Nagpur");
                gvwikireport.DataSource = dt;
                gvwikireport.DataBind();
    protected void btnExportToExcel_Click(object sender, EventArgs e)
                Page.Response.ClearContent();
                Page.Response.Buffer = true;
                Page.Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "WikiReport.xls"));
                Page.Response.ContentType = "application/ms-excel";
                StringWriter sw = new StringWriter();
                HtmlTextWriter htw = new HtmlTextWriter(sw);
                gvwikireport.AllowPaging = false;
                BindGridview();
                //Change the Header Row back to white color
                gvwikireport.HeaderRow.Style.Add("background-color", "#FFFFFF");
                //Applying stlye to gridview header cells
                for (int i = 0; i < gvwikireport.HeaderRow.Cells.Count; i++)
                    gvwikireport.HeaderRow.Cells[i].Style.Add("background-color", "#df5015");
                gvwikireport.RenderControl(htw);
                Page.Response.Write(sw.ToString());
                Page.Response.End();            
    But after clicking the 'Export To Excel' button i am getting the below error
    Control 'ctl00_SPWebPartManager1_g_d4fb972b_26ec_4065_9c89_80b51b384492_gvwikireport' of type 'GridView' must be placed inside a form tag with runat=server.
    In case if i am modifying the code as below I am getting error as 'page can have only one server tag'.
    <form id="frmgrdview" runat="server">
     <asp:GridView ID="gvwikireport" runat="server">
                 </asp:GridView></form>
    So please share your ideas/thoughts on the same.
    Regards,
    Sudheer 
    Thanks & Regards, Sudheer

    Hi,
    According to your post, my understanding is that you fail to export to excel.
    I create a demo as below, it works well.
    <table>
    <tr>
    <td>
    <asp:Label ID="Label1" runat="server" Text="Name"></asp:Label>
    </td>
    <td>
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
    </td>
    </tr>
    <tr>
    <td>
    <asp:GridView ID="gvwikireport" runat="server">
    </asp:GridView>
    </td>
    <td>
    <br />
    <asp:Button ID="btnExportToExcel" runat="server"
    onclick="btnExportToExcel_Click" Text="Export to excel" />
    </td>
    </tr>
    </table>
    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Data;
    using System.IO;
    namespace Export_to_Excel.VisualWebPart1
    public partial class VisualWebPart1UserControl : UserControl
    protected void Page_Load(object sender, EventArgs e)
    if (!Page.IsPostBack)
    BindGridview();
    private void BindGridview()
    DataTable dt = new DataTable();
    dt.Columns.Add("UserId", typeof(Int32));
    dt.Columns.Add("UserName", typeof(string));
    dt.Columns.Add("Education", typeof(string));
    dt.Columns.Add("Location", typeof(string));
    dt.Rows.Add(1, "SureshDasari", "B.Tech", "Chennai");
    dt.Rows.Add(2, "MadhavSai", "MBA", "Nagpur");
    dt.Rows.Add(3, "MaheshDasari", "B.Tech", "Nuzividu");
    dt.Rows.Add(4, "Rohini", "MSC", "Chennai");
    dt.Rows.Add(5, "Mahendra", "CA", "Guntur");
    dt.Rows.Add(6, "Honey", "B.Tech", "Nagpur");
    gvwikireport.DataSource = dt;
    gvwikireport.DataBind();
    protected void btnExportToExcel_Click(object sender, EventArgs e)
    Page.Response.ClearContent();
    Page.Response.Buffer = true;
    Page.Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "WikiReport.xls"));
    Page.Response.ContentType = "application/Excel";
    StringWriter sw = new StringWriter();
    HtmlTextWriter htw = new HtmlTextWriter(sw);
    gvwikireport.AllowPaging = false;
    BindGridview();
    //Change the Header Row back to white color
    gvwikireport.HeaderRow.Style.Add("background-color", "#FFFFFF");
    //Applying stlye to gridview header cells
    for (int i = 0; i < gvwikireport.HeaderRow.Cells.Count; i++)
    gvwikireport.HeaderRow.Cells[i].Style.Add("background-color", "#df5015");
    gvwikireport.RenderControl(htw);
    Page.Response.Write(sw.ToString());
    Page.Response.End();
    The result is as below:
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Update a gridview when contact form is closing

    Hallo
    Hope all are well.
    I got a NewCompany form that uses a clickevent to open another form to fill in contact details.
    But this then updates field in sql. I want to update the gridview with the new information when the contactform has been filled in.
    I created a method to run which is populating the main form, I made it public so can access the method on the contactform.
    below the code to update the gridview, this part is working when executing from the NewCompany.
    The next code is when I done the update and want to update the form.
    public void PopulateGridView()
    CreateConnection();
    try
    con = new SqlConnection(constring);
    cmd = new SqlCommand("Select CompanyDetailID, ContactID, Name, Surname, JobTitle, Cellphone, Landline, Extension, Email, Birthday, Notes " +
    "from ContactDetails " +
    "where CompanyDetailID = @SelectedSubDivID ",con);
    cmd.Parameters.AddWithValue("@SelectedCompanyID", SelectCompanyID);
    cmd.Parameters.AddWithValue("@SelectedSubDivID", SelectSubdivisionID);
    sda = new SqlDataAdapter(cmd);
    dt = new DataTable();
    sda.Fill(dt);
    dgContactInfo.DataSource = dt;
    dgContactInfo.Columns[0].Visible = false;
    dgContactInfo.Columns[1].Visible = false;
    catch (Exception ex)
    MessageBox.Show(ex.ToString());
    finally
    The code from the subform trying to execute the top part.
    private void txtSave_Click(object sender, EventArgs e)
    if (CheckEntryValidation())
    MessageBox.Show("All Filled In");
    if (ContactID == 0)
    try
    CreateConnection();
    con = new SqlConnection(constring);
    con.Open();
    cmd = new SqlCommand("INSERT INTO ContactDetails (CompanyDetailID, Name, Surname, JobTitle, Cellphone, Landline, Extension, " +
    "Email, Birthday, Notes) " +
    "VALUES (@CompanyDetailIDs, @Names, @Surnames, @JobTitles, @Cellphones, @Landlines, @Extensions, " +
    "@Emails, @Birthdays, @Notess) ", con);
    cmd.Parameters.AddWithValue("@CompanyDetailIDs", DetailID);
    cmd.Parameters.AddWithValue("@Names", this.txtName.Text.ToString().Trim());
    cmd.Parameters.AddWithValue("@Surnames", this.txtSurname.Text.ToString().Trim());
    cmd.Parameters.AddWithValue("@JobTitles", this.txtJobTitle.Text.ToString().Trim());
    cmd.Parameters.AddWithValue("@Cellphones", this.txtCellphone.Text.ToString().Trim());
    cmd.Parameters.AddWithValue("@Landlines", this.txtLandline.Text.ToString().Trim());
    cmd.Parameters.AddWithValue("@Extensions", this.txtExtension.Text.ToString().Trim());
    cmd.Parameters.AddWithValue("@Emails", this.txtEmail.Text.ToString().Trim());
    cmd.Parameters.AddWithValue("@Birthdays", dateOnly);
    cmd.Parameters.AddWithValue("@Notess", this.txtNotes.Text.ToString().Trim());
    cmd.ExecuteNonQuery();
    MessageBox.Show("Succesfully added");
    NewCompany Updgridview = new NewCompany();
    Updgridview.PopulateGridView();
    this.Close();
    catch (Exception ex)
    MessageBox.Show(ex.ToString());
    finally
    con.Close();
    labjac

    Hallo Fouad
    Thanks for the reply, below the code extractions I tried. it complains about a Null reference not set as a object, (Please see pictures attached). I think I might be doing something wrong. please let me know what parts you need to assist.
    Calling the ContactDetailsPopup form form the NewCompany form that got the gridview for updating:
    private void txtAddContact_Click(object sender, EventArgs e)
    if (SelectSubdivisionID != 0)
    GridSelectDetailsID = SelectSubdivisionID;
    GridSelectContactID = 0;
    ContactDetailsPopup ContactPage = new ContactDetailsPopup(GridSelectContactID, GridSelectDetailsID);
    ContactPage.Show();
    else
    MessageBox.Show("Please select Company and Sub Division first");
    The Constructor (I think)..
    private NewCompany UpdateMainView;
    public ContactDetailsPopup(NewCompany Ncomp)
    InitializeComponent();
    UpdateMainView = Ncomp;
    The Update and save:
    private void txtSave_Click(object sender, EventArgs e)
    if (CheckEntryValidation())
    if (ContactID == 0)
    try
    CreateConnection();
    con = new SqlConnection(constring);
    con.Open();
    cmd = new SqlCommand("INSERT INTO ContactDetails (CompanyDetailID, Name, Surname, JobTitle, Cellphone, Landline, Extension, " +
    "Email, Birthday, Notes) " +
    "VALUES (@CompanyDetailIDs, @Names, @Surnames, @JobTitles, @Cellphones, @Landlines, @Extensions, " +
    "@Emails, @Birthdays, @Notess) ", con);
    cmd.Parameters.AddWithValue("@CompanyDetailIDs", DetailID);
    cmd.Parameters.AddWithValue("@Names", this.txtName.Text.ToString().Trim());
    cmd.Parameters.AddWithValue("@Surnames", this.txtSurname.Text.ToString().Trim());
    cmd.Parameters.AddWithValue("@JobTitles", this.txtJobTitle.Text.ToString().Trim());
    cmd.Parameters.AddWithValue("@Cellphones", this.txtCellphone.Text.ToString().Trim());
    cmd.Parameters.AddWithValue("@Landlines", this.txtLandline.Text.ToString().Trim());
    cmd.Parameters.AddWithValue("@Extensions", this.txtExtension.Text.ToString().Trim());
    cmd.Parameters.AddWithValue("@Emails", this.txtEmail.Text.ToString().Trim());
    cmd.Parameters.AddWithValue("@Birthdays", dateOnly);
    cmd.Parameters.AddWithValue("@Notess", this.txtNotes.Text.ToString().Trim());
    cmd.ExecuteNonQuery();
    MessageBox.Show("Succesfully added");
    UpdateMainView.PopulateGridViewWithParm(DetailID, ContactID);
    this.Close();
    catch (Exception ex)
    MessageBox.Show(ex.ToString());
    finally
    con.Close();
    The Update Gridview Method on the NewCompany Main page where the gridview is present.
    public void PopulateGridViewWithParm(int CompanyID, int SubDivID)
    int loc_SelectCompanyID = CompanyID;
    int loc_SelectSubDivisionID = SubDivID;
    CreateConnection();
    try
    con = new SqlConnection(constring);
    cmd = new SqlCommand("Select CompanyDetailID, ContactID, Name, Surname, JobTitle, Cellphone, Landline, Extension, Email, Birthday, Notes " +
    "from ContactDetails " +
    "where CompanyDetailID = @SelectedSubDivID ", con);
    cmd.Parameters.AddWithValue("@SelectedCompanyID", CompanyID);
    cmd.Parameters.AddWithValue("@SelectedSubDivID", SubDivID);
    sda = new SqlDataAdapter(cmd);
    dt = new DataTable();
    sda.Fill(dt);
    dgContactInfo.DataSource = dt;
    dgContactInfo.Columns[0].Visible = false;
    dgContactInfo.Columns[1].Visible = false;
    catch (Exception ex)
    MessageBox.Show(ex.ToString());
    finally
    Please note that the updateGridview is working correctly when updated from the NewCompany page where the Gridview is present. 
    Regards,
    Jacques.
    labjac

  • Webpart button to generate pdf and print Gridview

    Hi
    Does anyone know how to generate a PDF that displays the contents of a Gridview using a button on a webpart?
    I'm using Sharepoint 2010 with iTextSharp but am getting javascript error 'RegisterForEventValidation can only be called during Render()'.
    Thanks in advance.

    Hi,
    According to your post, my understanding is that you wanted to convert the webpart content to pdf.
    To solve this problem, you can set EventValidation to false for the page and also override VerifyRenderingInServerForm in code behind to check whether it works.
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="VisualWebPart1UserControl.ascx.cs" Inherits="PDFFormExample.VisualWebPart1.VisualWebPart1UserControl" EnableEventValidation="false"%>
    public override void VerifyRenderingInServerForm(Control control)
    /* Confirms that an HtmlForm control is rendered for the specified ASP.NET
    server control at run time. */
    http://www.aspdotnet-suresh.com/2011/04/registerforeventvalidation-can-only-be.html
    http://www.codeproject.com/Questions/45450/RegisterForEventValidation-can-only-be-called-duri
    John Chapman had written a blog about using iTextSharp with SharePoint 2010, you can also check the steps with it, then check whether it works.
    http://www.sharepointjohn.com/sharepoint-2010-fill-out-and-flatten-pdf-forms-with-itextsharp/
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Theme icon images in GridView

    Not sure if this is something that I've read about already somewhere, but I've been spinning my wheels a bit trying to come up with a better solution.
    In most of my GridViews, I have already modified them a fair amount (added extra data by looping through the gridview rows in the OnPreRender) so while I was there, I assigned the column image URLs inside the code there using the NPBasePage.ThemesPath call. 
    I've come to the Saved Lists page and I'd be okay with just modifying it to have my theme path's add/remove images, but seems there must be a better way than looping through the gridview and changing it there.  Now that I think about it though, it seems to be doing some processing regardless of what you assign to the ImageUrl in the item template which is probably why I had ended up doing it inside that loop to begin with. 
    Is there a better way of doing this?
    Thanks.

    I'm not sure if I fully understand what you're trying to do .. but instead of your code looping over the gridview I normally add my control in the ItemTemplate itself and it will get called for each row in the grid. The event you decide to run your code in is still up to you.
    Have you tried just naming the icons with the same name in your theme folder? WebTools supports a dynamic image lookup so for example if there is an image "add.gif" that is currently in the assets/common/buttons folder, if you create your own image called add.gif and place it in your theme folder, WebTools should use this one automatically. This works in some places .. but I'm not sure if it is missing from some pages.

  • In edit mode in gridview everytime ihave to select dropdownlist otherwise its store first value

    <asp:GridViewID="GVTrouserJobWork"runat="server"  
    AutoGenerateColumns="False"CssClass="Gridview"HeaderStyle-BackColor="#4B6D9D
    "DataKeyNames="TrouserJobID"
    OnRowCancelingEdit="GVTrouserJobWork_RowCancelingEdit"OnRowDeleting="GVTrouserJobWork_RowDeleting"
    OnRowEditing="GVTrouserJobWork_RowEditing"OnRowUpdating="GVTrouserJobWork_RowUpdating">
    <Columns>
    <asp:TemplateFieldHeaderText="StyleNo"
    <asp:LabelID="lblStyleNo"runat="server"Text='<%#Eval("StyleNo")
    %>'/>
    <asp:DropDownList Width="60px"  DataSource='<%# GetStyleNo() %>' DataTextField="StyleNo"
                                        DataValueField="StyleNo" ID="StyleNo"
    runat="server">
                                    </asp:DropDownList>
    </EditItemTemplate>
    <ItemTemplate>
    <asp:LabelID="lblStyleNo1"runat="server"Text='<%#Eval("StyleNo")
    %>'/>
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
    </asp:GridView>
    public
    DataSetGetStyleNo() {
    SqlConnectionmyConnection =
    newSqlConnection(ConfigurationManager.ConnectionStrings["constring"].ToString());
    SqlCommandcmd =
    newSqlCommand();
                    cmd.Connection = con;
                    cmd.CommandText =
    "StleMasterList";
                    cmd.CommandType =
    CommandType.StoredProcedure;
    SqlDataAdapterad =
    newSqlDataAdapter("StleMasterList",
    myConnection);
    //SelectDDCompanyName
    DataSetds =
    newDataSet();
                    ad.Fill(ds,
    "StleMasterList");
    return
    ds;
    StleMasterList = Select StyleNo from Stylemaster
    protectedvoid
    GVTrouserJobWork_RowUpdating(objectsender,
    GridViewUpdateEventArgse)
    intTrouserOrderID =
    Convert.ToInt32(GVTrouserOrderDetail.DataKeys[e.RowIndex].Value.ToString());
    DropDownListStyleNo = (DropDownList)GVTrouserOrderDetail.Rows[e.RowIndex].FindControl("StyleNo");
    SqlCommandcmd =
    newSqlCommand("update
    TrouserOrders set StyleNo='"+
    StyleNo.SelectedValue.ToString() + "'where
    TrouserOrderID="+ TrouserOrderID, con);
     cmd.ExecuteNonQuery();
     con.Close();
    lblresult.ForeColor =Color.Green;
    lblresult.Text = " Details Updated successfully";
    GVTrouserOrderDetail.EditIndex = -1;
    BindTrouserOrderDetails();
    Actually I get dropdown in editmode but when without selecting dropdownlist if I update it it select first value of dropdown list.
    if have two dropdownlist in gridview and I want to update only one I cant do this every time I have to select both
    dropdownlist .

    Hello Fresherss,
    I think the ASP.NET forum will be more suitable for this thread:
    http://forums.asp.net/
    There are ASP.NET experts who will help you better.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Count word appearance and show in gridview

    Hello all, I am working on a project with multi tables. In one table the user selects one of 13 categories that they are uploading images to. Each category has a sub category. On the main page , I have a grid view for each category that list the subcategories.
    Much the way a classified ads would work, I want to be able to show the number of each image in the subcategories as in below.
    Name
    number
      of images
    Subcategory
    3
    Subcategory
    2
    Subcategory
    4
    Subcategory
    23
    Subcategory
    1
    Subcategory
    3
    Subcategory
    332
    Subcategory
    1
    Subcategory
    3
    Subcategory
    2
    Subcategory
    3
    I am using the count function in stored procedure that counts the number of images in subcategory entered
    select subcategory, count(*) as mycount from userinput group as subcategory.
    which gives me the count of each item under the subcategory listed by the user.
    I need to be able to take this count and show it next the  item name in the 13 tables that list the subcategories.
    So I am counting the entries from one table (datasource) and showing the number of entries in 13 different tables (GridViews) based on the name of the subcategory.
    this has to be done when the page loads so the usre will see the correct amount of images in the 13  grid views.
    Any ideas on how to do this??
    Thanks in advance.

    Hi Jasonpauthement,
    If I understand correctly, you want to display the categories and corresponding subcategories in the main table, then display the each subcategory and the corresponding count images in another 13 tables. If in this scenario, we can refer to the steps below
    to display another 13 tables:
    Drag a table with subcategory and the corresponding count images values to the design surface.
    Then use a list with the same dataset to contain the table.
    In Row Groups, Right-click the Details group to add a group grouped on subcategory.
    Then each subcategory and its corresponding count images values would be displayed in the list. If there are any misunderstanding, please elaborate the issue for further investigation.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Out-GridView Question

    Hello,
    I'm wondering if you can control the window size when using Out-GridView? For example:
    Get-Service | Out-GridView
    When this is run the window is showing more space than what I need; is it possible to have it shrink the window size to fit the results?

    I am not aware of any option, or parameter, to control the size of the form created by Out-GridView. It also doesn't seem change size depending on the content that is being displayed. You may need to create your own GUI element if you want to determine
    the size.

  • Issue with scroll viewer using itemswrapgrid in gridview?

    Hi,
    am developing a windows phone 8.1 app using C# and xaml.
    i need to wrap my gridviewitems vertically.
    I have 10 GridView items in my GridView am using the below code to wrap my gridview items,
    but am able to see only 6 items, the scrollviewer is not coming vertically even though there are some more items.
    (In the below code for reference i just added only one grid view item but i have 10 gridview items in my code ,
    for every gridview item the height and width are 175 and 175 respectively)
    <Page.Resources>
            <ItemsPanelTemplate x:Key="GridViewItemsPanel">
                <ItemsWrapGrid Orientation="Vertical" />
            </ItemsPanelTemplate>
        </Page.Resources>
     <GridView x:Name="landscapeGridview"  
                    HorizontalContentAlignment="Stretch"
                      HorizontalAlignment="Stretch"
                      VerticalAlignment="Stretch"
                      ItemClick="GridView_ItemClick"
                      IsItemClickEnabled="True" 
                      ItemsPanel="{StaticResource GridViewItemsPanel}"
                     ScrollViewer.HorizontalScrollMode="Disabled"
                     ScrollViewer.VerticalScrollMode="Enabled"
                     ScrollViewer.HorizontalScrollBarVisibility="Visible"
                     ScrollViewer.VerticalScrollBarVisibility="Auto"
                      Grid.Row="2" Padding="10,0,0,0">   
    <GridViewItem Height="175" Width="175" Margin="0,5,5,0">
                            <Border Height="165" Width="165"
                        Tag="Notes" Background="#DDECEF">
                                <Grid>
                                    <Image Source="Assets/.png" Margin="0,0,0,0"></Image>
                                    <Image Source="Assets/.png" Margin="0,20,20,0" HorizontalAlignment="Right"
                                       VerticalAlignment="Top" Height="40" Visibility="Collapsed"></Image>
                                    <StackPanel    Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush}"  
                                                     VerticalAlignment="Bottom" Margin="0,0,0,0" Height="30"
    Orientation="Horizontal"
                                               >
                                        <TextBlock Text="" FontSize="20"
                                 Margin="50,0,0,0"
                                   HorizontalAlignment="Center" 
                                            RequestedTheme="Dark"
                                   ></TextBlock>
                                        <TextBlock x:Name="notescounttxtblk" VerticalAlignment="Center" Margin="30,0,0,10"
                                          FontSize="20"></TextBlock>
                                    </StackPanel>
                                </Grid>
                            </Border>
                        </GridViewItem>
    </GridView>
    How to get the scroll viewer to view all the items vertically?
    Any help please?

    Hi Santhosh,
    Per my understanding, this issue is related to container definition where you put your GridView control. In this case, it is the Grid container.
    First you can see a working sample,
    https://code.msdn.microsoft.com/windowsapps/ListViewSimple-d5fc27dd. See the scenario 1 in windows phone project, I can reproduce your issue by setting the height of RowDefinition to “auto” where the GridView control sitting in. You need to check the height
    and width property of the layout. See more information about layout in XAML.
    https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh465337.aspx.
    You’ve not mentioned the definition of the Grid layout, I assume you need change the RowDefinition. If you don’t know how, please see details in above code sample.
    Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • [Sorting Problem In The GridView]

    I'm using the oracle 10.2.02 beta client with the VisualStudio.NET 2005.
    The problem is that the sorting function in the GridView doesn't work.
    Is there any way to "connect" the SqlDataSource tool with the oracle connection through a DataSet ? That is to say, the only way to enable sorting in the GridView is to connect it with the SqlDataSource object (accordind to the MSDN help). The SqlDataSourceMode enable us to use a DataSet into the SqlDataSourse but I can't fint HOW....
    Any suggestions?

    Thanks Peluka.
    But even I don't enhance the vendor search help, I still found that the original standard version has this problem after sorting.
    Is that the program bug?
    Have anyone encountered this problem before?

  • Need data edit,update and delete in the gridview

    Hi friends,
    I am facing a common problem which everyone already faced but I need to know is there anything new comes with this issue?
    My problem is I want to Edit, Update and Delete data in gridview in multiple column. I can do the edit , update,cancel and delete but what I want is I dont want this button to perform this. I mean when I load data in gridview the data will show in edit mode
    and when I edit any dat, the update will occur instantly in the sql server database. 
    Is there anything new development comes? whatever it is if its ajax or java script or something else please give me detail.
    Thanks for reading my post.
    Regards

    Questions related to ASP.NET should be posted in the ASP.NET forums (http://forums.asp.net ).

  • GridView Sorting with multiple word in header

    Dear All
    we have dynamic GridView. we want to sort the gridview. we have multiple words in the header column like (Chicken Burger, Small Pizza , Chicken Roll etc). i m using below code but its giving me error on clicking header (Chicken Burger) like
    Cannot find column Chicken Inserts.
     protected void gv_SearchResults_Sorting(object sender, GridViewSortEventArgs e)
                 string Search= "SearchAllFOs";
            DataTable dtbl = ShowAllItemsData(SearchAllFOs);
            gv_SearchResults.DataSource = dtbl;
            gv_SearchResults.DataBind();
            if (ViewState["Sort Order"] == null)
                dtbl.DefaultView.Sort = e.SortExpression + " DESC";
                gv_SearchResults.DataSource = dtbl;
                gv_SearchResults.DataBind();
                ViewState["Sort Order"] = "DESC";
            else
                dtbl.DefaultView.Sort = e.SortExpression + "" + " ASC";
                gv_SearchResults.DataSource = dtbl;
                gv_SearchResults.DataBind();
                ViewState["Sort Order"] = null;
    Thanks and Best Regards Umair

    Hello Muhammad Umair 2756,
    Since we saw this GridViewSortEventArgs  https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridviewsorteventargs(v=vs.110).aspx
    Your project is actually a web project and please follow CoolDadTx's suggestion to post on ASP.NET forum.
    Best regards,
    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • Batch change -  Email generation

    Hello Gurus,   I have a requirement related to batch change (MSC2N).  Whenever a user changes batch characteristics on classification tab and hits the save button, an email needs to be generated to a mailing list. This is not required for all the cha

  • I CAN SEE ALL SHIP TO LOCATIONS FOR THE CUSTOMER EVEN IF I SELECT ONE BILL

    Dear, I CAN SEE ALL SHIP TO LOCATIONS FOR THE CUSTOMER EVEN IF I SELECT ONE BILL TO Steps: Create customer name "customer 1" Under this customer, I create 2 new address "Customer A " with tow business purpose 1-bill to –> customer A 2- ship to-> cust

  • Garbled Video when Displaying Desktop

    Has anyone ever seen distortion like this when trying to share your desktop? If you can't make it out - it's the top edge of the persons desktop icons repeated vertically down the screen. Any ideas?

  • Currency type is showing up in the report

    Hi Gurus, In one of report results, the currency type is missing and it showing the results as -5,000.00 * 107,000.00 ERROR Can some body helps me in correcting the same Thanks in advance. Murali

  • TS3276 Can't open email attachments

    Can't open email attachments