RSS

Monthly Archives: February 2011

Multiple Problem Solution


How to Add Symblol to Gridview

 

public static string CurrenceSymble = string.Empty;

 

CurrenceSymble = ConfigurationManager.AppSettings.Get(“Currency”);

lblRegFeeCrSybble.Visible = true;

lblRegFeeCrSybble.Text = CurrenceSymble;

 

 

 

<asp:TemplateField HeaderText=”Amount”>

<ItemTemplate>

<asp:Label ID=”lblAmountgv” runat=”server” Text='<%# Bind(“Amount”) %>’></asp:Label>

</ItemTemplate>

</asp:TemplateField>

 

 

 

 

 

decimal priceTotal = 0;

 

 

protected void GVInstallment_RowDataBound(object sender, GridViewRowEventArgs e)

{

if (e.Row.RowType == DataControlRowType.DataRow)

{

// add the UnitPrice and QuantityTotal to the running total variables

priceTotal = Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, “Amount”));

((Label)e.Row.FindControl(“lblAmountgv”)).Text =lblRegFeeCrSybble.Text + ‘ ‘ + priceTotal;

 

}

 

 

//if(e.Row.RowType == DataControlRowType.DataRow)

 

//       ((Label)e.Row.FindControl(“lblAmountgv”)).Text  =((DataRowView)e.Row.DataItem)[“Amount”].ToString();

 

}

 

 

 

E-Mail Validation


////Single Selection RadioButton on GridView+c-sharpcorner

 

 

<asp:RegularExpressionValidator ValidationGroup=”AddCampus”

ID=”EmailRegularExpressionValidator”

runat=”server”

ControlToValidate=”txtEmail”

Display=”Dynamic”

ValidationExpression=”\w+([-+.’]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*”>

* Invalid e-mail address.

</asp:RegularExpressionValidator>

 

<asp:RequiredFieldValidator ID=”RFVEmail” runat=”server”

ErrorMessage=”Please Enter E-Mail”  Display=”None” ControlToValidate=”txtEmail”  ValidationGroup=”AddCampus”></asp:RequiredFieldValidator>

<asp:ValidatorCalloutExtender ID=”VCERFVEmail” runat=”server”

TargetControlID=”RFVEmail”>

</asp:ValidatorCalloutExtender>

 

 

 

<asp:UpdatePanel ID=”UpdatePanel1″ runat=”server”>

<ContentTemplate>

 

 

</ContentTemplate>

</asp:UpdatePanel>

 

 

 

 

Enable Disable Button Status in Gridview

Client Side

<asp:TemplateField HeaderText=”Action” ItemStyle-Width=”140px”>
<ItemTemplate>
<asp:Button ID=”btnDelete” runat=”server”   CommandName=”Delete” SkinID=”DeleteButton” Text='<%# Bind(“Status”)%>’ CommandArgument='<%# Container.DisplayIndex %>’    />
<asp:Button ID=”btnReject” runat=”server”   CommandName=”Update” SkinID=”Reject”    />

</ItemTemplate>
</asp:TemplateField>

Code Behind

protected void GVDocumentRequest_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == “Delete”)
{
GridView gv = (GridView)sender;
int index = int.Parse(e.CommandArgument.ToString());
int id = (int)gv.DataKeys[index][“RequestID”];
string name = (string)gv.DataKeys[index][“RequestStatus”];
if (name == “Enable”)
{

DALStudentDocumentRequests.DisableStdDocRequestStatus(id);
BindGVDocumentRequest();
}
else
{
DALStudentDocumentRequests.EnableStdDocRequestStatus(id);

BindGVDocumentRequest();
}
}
}

Advertisements
 
Leave a comment

Posted by on February 23, 2011 in ASP Dot Net C#