"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Showing posts with label Grid. Show all posts
Showing posts with label Grid. Show all posts

Friday, February 1, 2013

addition operation in Grid inside the text box using javascript

Having addition operation on gridview in JavaScript.


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

Saturday, November 12, 2011

Hyperlink with more than one parameter Or Error: Server tag not well Formed with Hyperlink

Hi *.*,
In my first day of .net i found this error the with the help of my senior i resolved it.Then i didn't know why it come so.2day my junior faced same issue i gone through and got why it come :).its all because when binding hyperlink with data not at just data, you have to give entire NavigateUrl the Server control. and also (single quote) and (Double quote) have to be in correct way too...

Tuesday, November 8, 2011

Monday, September 12, 2011

Nested grid and findControl over child grid

Hi *.*,
Nested grid and findControl over child grid
Over here i have two gridview (GridView1,GridView2) and on 2nd grid  a linkbutton, onclick event i need to extract particular row data. that my need here its go.
 On HTML


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowDataBound="GridView1_RowDataBound">
            <Columns>
                <asp:TemplateField HeaderText="Project">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("PkID") %>'></asp:Label>
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("StrName") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Sub Task">
                    <ItemTemplate>
                        <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" OnRowCommand="GridView2_RowCommand">
                            <Columns>
                                <asp:TemplateField HeaderText="Task Name">
                                    <ItemTemplate>
                                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("name") %>'></asp:Label>
                                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("pk") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Task Status">
                                    <ItemTemplate>
                                        <asp:DropDownList ID="DropDownList1" runat="server">
                                            <asp:ListItem>Open</asp:ListItem>
                                            <asp:ListItem>Close</asp:ListItem>
                                            <asp:ListItem>Finish</asp:ListItem>
                                        </asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Select" CommandArgument="<%#((GridViewRow) Container).RowIndex %>">Update</asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <HeaderStyle BackColor="#CCCCFF" />
                        </asp:GridView>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <HeaderStyle BackColor="Maroon" ForeColor="#FFCC00" />
        </asp:GridView>
    </div>
    </form>
</body>
</html>

 
protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            GridView1.DataSource = d("SELECT PkID, StrName, DateTimeStamp FROM T2");
            GridView1.DataBind();
        }
    }

    public SqlDataReader d(string _Query)
    {
        SqlCommand cmd = new SqlCommand(_Query, con());
         return cmd.ExecuteReader();

    }

    public SqlConnection  con()
    {
        SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["ConnectionDemoString"].ToString());
        con.Open();
        return con;
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        try
        {
            if (e.Row.RowType == DataControlRowType.DataRow)// Bind nested grid view with parent grid view
            {
                string _name = ((Label)e.Row.FindControl("Label3")).Text;
                GridView griedview2 = (GridView)e.Row.FindControl("GridView2");
                griedview2.DataSource = d("SELECT     pk, name, DrpDwn FROM         TBNAME where DrpDwn='" + _name + "'");
                griedview2.DataBind();
            }
        }
        catch (Exception)
        {
           
            throw;
        }
    }
    protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        GridView GridView2 = (GridView)sender;  //find nested grid view
        GridViewRow chrow = (GridViewRow)GridView2.Parent.Parent; // parent grid's row for find any control from parent grid view
        if (e.CommandName == "Select")
        {
            int index = Convert.ToInt32(e.CommandArgument); //use command argument for identify row with nested grid view

            int pid = Convert.ToInt32(((Label)GridView2.Rows[index].FindControl("Label4")).Text); // id from labe4 of nested grid view
            DropDownList childrop = ((DropDownList)GridView2.Rows[index].FindControl("DropDownList1")); // get dropdownlist box of nested grid view
            string status = childrop.SelectedItem.Text;
        }

Hope u guys got it....If any trouble message me. :)
Stay Tune...
Have a nice day... 'N happy Coding :)

Friday, August 5, 2011

Zoom Effect on Grid Using Jquery and Css in asp.net

Hi *.*,
Recently i visited http://www.sohtanaka.com. I found this zoom effect. I get all the details from their and integrate in asp.net