Tuesday, July 14, 2015

Solved :An unexpected error occurred while compiling expressions. Native compiler return value: ‘[BC2001] file 'C:\Windows\TEMP\bgmkithf.0.vb' could not be found’.

Solution:
Follow the following instructions to get rid of the error.
Step 1:
Go to your IIS (Internet Information Service) manager. Click on “Application Pools” which is on left upper side of IIS manager.

Then you will see all pools list existing on IIS on the right side.
Step 2:
Create a new pool. Right click on right side. You will get the option named “Add Application Pool”.


Click on this option and a form will be popped up before you.

Put the “Name” (My project display name on browser is MFS so I used MFS. You can use your name too. No boundaries…J) And select the “.Net Framework version” which you are using in your project. Here I used .Net Framework 4.0.
After creation, a new pool will be seen on right side pool list.

Step 3:
Now change some Advance Settings (on your right side) of your newly created application pool.

Choose “Local System” as an option for Identity section in settings properties.
Step 4:
Now click on project name (left side) on IIS server. Then click on its Advance Settings section (right side) to change its pool from “DefaultAppPool” to “MFS” (your provided pool name).

Step 5:
Your all steps are done. Now just let’s “Restart” (This option is provided on right side of your window) the IIS manager to kick out this problem from your deployment difficulties list.

Now enjoy your reports without seeing any crazy error. Happy coding…J

Monday, July 22, 2013

RadioButton Single Check in GridView: (Javascript)




 --------------html code view------------------------------------------------------

<script>

function SelectSingleRadiobutton(rdbtnid) {
var rdBtn = document.getElementById(rdbtnid);
var rdBtnList = document.getElementsByTagName("input");
for (i = 0; i < rdBtnList.length; i++) {
if (rdBtnList[i].type == "radio" && rdBtnList[i].id != rdBtn.id)
{
rdBtnList[i].checked = false;
}
}
}
</script>

</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="gvdata" runat="server" CssClass="Gridview" AutoGenerateColumns="false" DataKeyNames="UserId" HeaderStyle-BackColor="#7779AF" HeaderStyle-ForeColor="White">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:RadioButton id="rdbUser" runat="server" OnClick="javascript:SelectSingleRadiobutton(this.id)" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="UserName" HeaderText="Name"/>
<asp:BoundField DataField ="FirstName" HeaderText="FirstName" />
<asp:BoundField DataField="LastName" HeaderText="LastName" />
<asp:BoundField DataField="Location" HeaderText="Location" />
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>



In code behind bind your gridview and check it 


protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGridviewData();
}
}
protected void BindGridviewData()
{
SqlConnection con = new SqlConnection("Data Source=MYSystem;Initial Catalog=MySamplesDB;Integrated Security=True");
con.Open();
SqlCommand cmd = new SqlCommand("select UserId,UserName,FirstName,LastName,Location from User_Information", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
gvdata.DataSource = ds;
gvdata.DataBind();
con.Close();
}






Implementing Service Locator (To Resolve Dependency)

using System; /// <summary> /// Summary description for Class1 /// </summary> public class serviceLocator {     public s...