Archive

Archive for February, 2013

Check if list exists or not in SharePoint 2010

February 27, 2013 Leave a comment

Hi all,

Try this example to Check if list exists or not in SharePoint 2010 using TryGetList method.

This method belongs to class SPListCollection and it is available in SharePoint 2010.


using ( SPSite site = new SPSite ( "http://Site URL" ) )
{
 using ( SPWeb web = site.RootWeb )
 {
 SPList list = web.Lists.TryGetList("List Name");
 if ( list != null )
 {
 // We found the List
 }
 else
 {
 //If List does not exists then it will not through any exception, it will return Null
 }
 }
}

Hope this helps

Good Luck

 

Categories: SharePoint 2010

Solve Problem ‘Microsoft.Jet.OLEDB.4.0′ provider is not registered on the local machine

February 21, 2013 Leave a comment

Hi all,

In this post i will explain how to solve when You get this error when running your application: ‘Microsoft.Jet.OLEDB.4.0’ provider is not registered on the local machine.

Open IIS (Internet Information Service)  that your application was published there

In the Connections pane, select your application

img1

 

Click ‘Advanced Settings’ and verify the application pool used by your application.

img2

Then select that application pool in the connection pane

img3

Click ‘Advanced Settings’ and set ‘Enable 32-bit Applications’ to True

img4

Hope this helps

for more information you can check this link

Good Luck.

Categories: ASP.Net

Get Selected Row Values from Asp.net Gridview on Checkbox Selection using JQuery

February 4, 2013 Leave a comment

Hi all,

try this example to  Get Selected Row Values from Asp.net Gridview on Checkbox Selection using JQuery


<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function() {
$('#btnGet').click(function() {
var hdntxt = '';
$("input[name$=chkChild]:checked").each(function() {
hdntxt += "," + $(this).next("input[name$=hdnId]").val()
});
$('#lbltxt').text(hdntxt.substring(1,hdntxt.length))
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="gvUserInfo" runat="server" >
<HeaderStyle BackColor="#df5015" Font-Bold="true" ForeColor="White" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkChild" runat="server" />
<asp:HiddenField ID="hdnId" runat="server" Value='<%#Eval("UserName") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
<input type="button" id="btnGet" value="Get Selected Values" /><br /><br />
<b>Select UserNames:</b><label id="lbltxt"/>
</form>
</body>
</html>

In code behind :


using System;
using System.Data;
using System.Data.SqlClient;

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGridview();
}
}
// This method is used to bind gridview from database
protected void BindGridview()
{
SqlConnection con = new SqlConnection("Data Source=DB;Integrated Security=true;Initial Catalog=MySampleDB");
con.Open();
SqlCommand cmd = new SqlCommand("select UserName,LastName,Location from UserInformation", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
gvUserInfo.DataSource = ds;
gvUserInfo.DataBind();
}

Hope this helps

for more information check this

Good Luck

Categories: ASP.Net, Jquery