SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot pavanpuligandla's Avatar
    Join Date
    Sep 2008
    Location
    hyderabad
    Posts
    179
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ASP.NET DataGrid Row Click.

    Hi all,
    i'm a asp.net beginner,
    and developing a simple content management system using c#.net.
    i'm having 2 tables in my DB where the page titles and html content and page title id's are stored.
    my task is to pull the page titles from table and display them in a datagrid and when datagrid row is clicked i';ll have to show a html editor(WYSWIG) with its html content loaded if html content exist in the table.

    i succeeded in pulling page title column from database to the datagrid, now i need to display the html editor with relative data based on datagrid row ID.
    can anyone please help me out..
    thanks,
    PHP Professional turned ASP.NET Professional

  2. #2
    SitePoint Mentor NightStalker-DNS's Avatar
    Join Date
    Jul 2004
    Location
    Cape Town, South Africa
    Posts
    2,877
    Mentioned
    46 Post(s)
    Tagged
    0 Thread(s)
    I would recommend you have an "Edit" button/link on the gridview row, which then clicks through to a page with the WYSIWYG editor on. Will make ur life a bit easier. I would also recommend you use tineMCE. Def one of the better WYSIWYG editors out there

  3. #3
    SitePoint Zealot pavanpuligandla's Avatar
    Join Date
    Sep 2008
    Location
    hyderabad
    Posts
    179
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    Thanks for the comeback.
    I would like to ask you a question, how to enable a html editor when datagrid row has been clicked?
    and i need to capture datagrid row ID and put it in a variable.
    here is my code for tha, can you please suggest how to do this.

    Code Csharp:
    private void PopulateDataGrid()
            {
                this.dgContentManagement.DataSource = ContentManagementActivities.GetContentManagementDetails();
                this.dgContentManagement.DataBind();
            }
     
            protected void dgContentManagement_RowDataBound(object sender, GridViewRowEventArgs e)
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    e.Row.Attributes.Add("onclick", ClientScript.GetPostBackEventReference(this.dgContentManagement, "Select$" + e.Row.RowIndex.ToString()));
                    e.Row.Style.Add("cursor", "pointer");
                }
            }
     
            protected void dgContentManagement_SelectedIndexChanged(object sender, EventArgs e)
            {
     
     
                Int32 ContentPageId = Convert.ToInt32(dgContentManagement.SelectedValue);
     
                //Int32 ContentPageId;
                //You have to insert related code here
                //ContentPageId = this.dgContentManagement.SelectedValue.ToString();
     
                //Response.Redirect("ContentManagementHome.aspx?" + "content_page_id=" + this.dgContentManagement.SelectedValue.ToString());
                //txtContentDescription.Visible = true;
                //btnSubmit.Visible = true;
            }

    Thanks.
    PHP Professional turned ASP.NET Professional

  4. #4
    SitePoint Mentor NightStalker-DNS's Avatar
    Join Date
    Jul 2004
    Location
    Cape Town, South Africa
    Posts
    2,877
    Mentioned
    46 Post(s)
    Tagged
    0 Thread(s)
    You should be able to pick it up with dgContentManagement.DataKeys[e.RowIndex]. Not 100% sure now as I have not used this in a while.

    Just also make sure you set the correct column as the Key for the gridview.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •