Sunday, April 6, 2014

URL Parameter Pass in Iframe Or Access Value In Aspx page

<iframe id="questionare" src="Questionare.aspx?Clienid=<%=hdfLeadId.Value %>" width="100%" height="550" frameborder="0" allowtransparency="0"></iframe>

Saturday, April 5, 2014

Access hidden field in gridview

string sValue = ((HiddenField)dgvContent.FindControl("hdfLeadId")).Value;

Remove border From Gridview

  protected void dgvContent_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            foreach (TableCell tc in e.Row.Cells)
            {
                tc.BorderStyle = BorderStyle.None;

            }
        }

Friday, April 4, 2014

Scroll bar fro gridview

 <div style="width: 294px; height: 122px; overflow: scroll">
                        <asp:GridView ID="dgvExpertise" AllowSorting="true" AllowPaging="true" PageSize="10"
                            AutoGenerateColumns="false" class="table table-bordered coursesTable" Style="border-collapse: initial;"
                            runat="server" PagerSettings-Mode="Numeric" PagerSettings-PageButtonCount="10"
                            OnPageIndexChanging="dgvExpertise_PageIndexChanging">
                            <RowStyle />
                            <AlternatingRowStyle BackColor="#f9f9f9" />
                            <PagerStyle HorizontalAlign="Left" CssClass="pager" />
                            <HeaderStyle BackColor="#D6D5D6" />
                            <EmptyDataTemplate>
                                No Record Found
                            </EmptyDataTemplate>
                            <Columns>
                                <asp:BoundField DataField="LeadId" HeaderText="LeadId" HeaderStyle-ForeColor="Black" />
                                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                                <asp:BoundField DataField="Phone" HeaderText="Phone" HeaderStyle-ForeColor="Black" />
                                <asp:BoundField DataField="LeadCategoryName" HeaderText="Status" HeaderStyle-ForeColor="Black"
                                    SortExpression="LeadCategoryName" />
                                <asp:BoundField DataField="ReferredBy" HeaderText="ReferredBy" HeaderStyle-ForeColor="Black"
                                    SortExpression="ReferredBy" />
                            </Columns>
                        </asp:GridView>
                    </div>

SqlConnectionString in ASP.NET

Step 1 :  Add this to asp.net .cs page
SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["ValweaveFa"].ConnectionString);

Step 2 : Add below lines to web.conf

<connectionStrings>
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
providerName="MySql.Data.MySqlClient" />
<add name="ValweaveFa" connectionString="Data Source=ADMIN-PC\SQLEXPRESS;Initial Catalog=Valweave;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>

Thursday, April 3, 2014

Replace all commas in a string with JQuery/Javascript

 var income = $("#txtincome").val();
        if (income == "") {

        }
        else {
            income = income.replace(",", "")
            alert(income);
        }

Open Page in new tab on button click ASP.NET

<asp:Button ID="btn" runat="Server" Text="SUBMIT" 
     OnClick="btnNewEntry_Click" OnClientClick="aspnetForm.target ='_blank';"/>

protected void btnNewEntry_Click(object sender, EventArgs e)
{
    Response.Redirect("Questionare.aspx");
}