|
Hello friends,
i'm new to sharepoint developing with asp.net
i need to customize the microsoft's contact management system without creating new
project
how can i proceed this ?
thanks in advance
|
|
|
|
|
Please can anybody tell me,
how to check background printing is enabled or not in client browser through code either in javascript or C#. I have to enable it or atleast to show message to end user to enable it for proper output.
|
|
|
|
|
I have a website hosted in Server which I want to expose it to one client(outside network).I have opened a server side port.Do I need to open client side port also.If not what is the thing which needs to be done?
Thanks in advance
Rao
|
|
|
|
|
You can do it by restricting IP Address in IIS for that site.
|
|
|
|
|
avi_dadi2002 wrote: I have a website hosted in Server which I want to expose it to one client(outside network).I have opened a server side port.Do I need to open client side port also.If not what is the thing which needs to be done?
Does it any thing related with ASP.Net. If you want to share your sites only with your one client, then you have to place the site in a same network. The better option is contact with your Network Team, they can give you better idea to host the side.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
you need to change ur local IP to static IP(contact sys admin)
Then u can access your site over the Internet..
or u just share your desktop to UR client..using logmein or teamviewer..etc
Regards
Rajeesh MP
|
|
|
|
|
What is the use of Ajax concept in Asp.net? can anyone explain?
|
|
|
|
|
|
Given the amount that's been written on the web about AJAX, if you can't work it out with google, I'd say, don't worry about it.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Karthick_gc wrote: What is the use of Ajax concept in Asp.net? can anyone explain?
Yes. Check here[^]
and
Read This[^]
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Hi ,
Ihave a datagrid ,and the code for the date field is some what
<asp:BoundColumn DataField="RegistrationDate" HeaderText="Reg Date" SortExpression="RegistrationDate" DataFormatString="{0:yyyy/mmm/dd}">
<HeaderStyle Font-Bold="True" Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundColumn>
but the date is not comming in the yyyy/mmm/dd format
in the datagrid i enabled the sorting and i am using the following code for that
DataSet ds = CandidateManager.getCandidateDetails(cboStatus.SelectedValue, cboLocation.SelectedItem.Text.Trim(),cboType.SelectedItem.Text.Trim(),txtName.Text.Trim(),txtCurrentOrg.Text.Trim(),txtRegFromDate.Text.Trim(),txtRegToDate.Text.Trim(),m_summaryDetails);
DataView Source = ds.Tables["CANDIDATE_MASTER"].DefaultView;
Source.Sort = e.SortExpression;
Session["Candidate_Sort"] = e.SortExpression;
DGInbox.DataSource = Source;
DGInbox.DataBind();
But the sorting is not happening properly.
It is happening acoording to the month only.
(Actually i want to get the date in yyyy/mmm/dd format
,but getting mmm/dd/yyyy format,and sorting is
happening with month only)
|
|
|
|
|
Your format string isn't quite correct. I don't remember them all, but I know that month is a capital 'M', lowercase 'm' is minute.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
//file1.aspx
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TxtJobID" runat="server"></asp:TextBox>
<asp:TextBox ID="TxtJobTitle" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"
Text="Update" OnClientClick="return confirm('Are You Sure');" Font-Bold="True" />
<br />
<br />
<asp:Label ID="lblMessage" runat="server" Text="Label" Width="474px"
style="background-color: #00cccc"></asp:Label><br />
<br />
<asp:DataGrid id="DataGrid1" OnItemCommand="ItemCommand"
style="Z-INDEX: 101; LEFT: 175px; TOP: 105px"
runat="server" CssClass="tx-tbl-Gr-lml" Width="474px" AllowPaging="true" >
<Columns>
<asp:ButtonColumn Text="Edit" ButtonType="PushButton" CommandName="Edit">
</asp:ButtonColumn>
<asp:ButtonColumn Text="Delete" ButtonType="PushButton" CommandName="Delete">
</asp:ButtonColumn>
</Columns>
</asp:DataGrid><br />
</div>
</form>
</body>
//file1.aspx.cs
public partial class _Default : System.Web.UI.Page
{
OracleConnection cn;
OracleCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
cn = new OracleConnection("data source=dev;user id=hr;password=hr");
if (!Page.IsPostBack)
{
BindData();
}
}
void BindData()
{
string strsql = "select job_id,job_title from jobs";
OracleDataAdapter da = new OracleDataAdapter(strsql, cn);
DataTable dt = new DataTable();
da.Fill(dt);
DataGrid1.DataSource = dt;
DataGrid1.DataBind();
}
protected void ItemCommand(Object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if (e.CommandName == "Edit")
{
FillTheData(e.Item.Cells[2].Text, e.Item.Cells[3].Text);
lblMessage.Text = "";
}
if (e.CommandName == "Delete")
{
lblMessage.Text = "Need Code to call confirm() frunction ";
}
}
void FillTheData(string job_id, string job_title)
{
TxtJobID.Text = job_id;
TxtJobTitle.Text = job_title;
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
string strsql = "Update jobs set job_title="+"'"+TxtJobTitle.Text+"'"+" where job_id="+"'"+TxtJobID.Text+"'";
cmd = new OracleCommand(strsql, cn);
cn.Open();
cmd.ExecuteNonQuery();
BindData();
lblMessage.Text = "Updated Successfully";
}
catch (Exception ex)
{
lblMessage.Text = ex.Message;
}
finally
{
cn.Close();
}
}
}
|
|
|
|
|
define your problem rather then code? put your question first and then put the code.
|
|
|
|
|
the problem is that i want to add confirmation from the user to delete the record when the delete button is pressed in the grid.
i have the code to delete the record. Just need help how to call the cofirm() javascript function.
and what changes should i make in the code to call the function
//file1.aspx
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TxtJobID" runat="server"></asp:TextBox>
<asp:TextBox ID="TxtJobTitle" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"
Text="Update" OnClientClick="return confirm('Are You Sure');" Font-Bold="True" />
<br />
<br />
<asp:Label ID="lblMessage" runat="server" Text="Label" Width="474px"
style="background-color: #00cccc"></asp:Label><br />
<br />
<asp:DataGrid id="DataGrid1" OnItemCommand="ItemCommand"
style="Z-INDEX: 101; LEFT: 175px; TOP: 105px"
runat="server" CssClass="tx-tbl-Gr-lml" Width="474px" AllowPaging="true" >
<Columns>
<asp:ButtonColumn Text="Edit" ButtonType="PushButton" CommandName="Edit">
</asp:ButtonColumn>
<asp:ButtonColumn Text="Delete" ButtonType="PushButton" CommandName="Delete">
</asp:ButtonColumn>
</Columns>
</asp:DataGrid><br />
</div>
</form>
</body>
//file1.aspx.cs
public partial class _Default : System.Web.UI.Page
{
OracleConnection cn;
OracleCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
cn = new OracleConnection("data source=dev;user id=hr;password=hr");
if (!Page.IsPostBack)
{
BindData();
}
}
void BindData()
{
string strsql = "select job_id,job_title from jobs";
OracleDataAdapter da = new OracleDataAdapter(strsql, cn);
DataTable dt = new DataTable();
da.Fill(dt);
DataGrid1.DataSource = dt;
DataGrid1.DataBind();
}
protected void ItemCommand(Object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if (e.CommandName == "Edit")
{
FillTheData(e.Item.Cells[2].Text, e.Item.Cells[3].Text);
lblMessage.Text = "";
}
if (e.CommandName == "Delete")
{
lblMessage.Text = "Need Code to call confirm() frunction ";
}
}
void FillTheData(string job_id, string job_title)
{
TxtJobID.Text = job_id;
TxtJobTitle.Text = job_title;
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
string strsql = "Update jobs set job_title="+"'"+TxtJobTitle.Text+"'"+" where job_id="+"'"+TxtJobID.Text+"'";
cmd = new OracleCommand(strsql, cn);
cn.Open();
cmd.ExecuteNonQuery();
BindData();
lblMessage.Text = "Updated Successfully";
}
catch (Exception ex)
{
lblMessage.Text = ex.Message;
}
finally
{
cn.Close();
}
}
}
Above is the code
|
|
|
|
|
put the button between span tag.
/*
<span onclick=return confirm('Are you sure to Delete the record?')>
<asp:button id="deletelink" text="Delete" runat="server" commandargument="<%#Eval("id") commandname="deletebtn" xmlns:asp="#unknown">
</asp:button>
</span>
*/
Regards
Keyur Satyadev
modified on Thursday, March 12, 2009 8:53 AM
|
|
|
|
|
AJAX has a way to do a confirm. Pretty simple too, and an example found on the AJAX site.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Hi,
You can write the javascript function for the button click....
|
|
|
|
|
protected void grd_detail_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[4].Attributes.Add("onClick", "return confirm('Are you sure you want to delete the record?');");
}
}
use this code in event row data bound of grid view
|
|
|
|
|
hi all ,i am a newbie here.
recently,i need to creat a real-time responsing comment page.if client sent a comment.it will auto refuse page and display what client post in comment board.
sorry that cos my english is limited,maybe i can't describe it properly
(i have been asked the question in local forum,but there is no answer)
here is the question:
when submited,datas writed into database.
in CS file, it reture latest date "DataTable" to "get_Result_CallBack "
code here:
function get_Result_CallBack(response)
{
if (response.value != null)
{
z = 0;
var ds = response.value;
if(ds != null && typeof(ds) == "object" && ds.Rows != null)
{
arrCellText[0] = ds.Rows[0].Message+" "+ds.Rows[0].UpdateDate ;
arrCellText[1] = ds.Rows[0].Name ;
arrCellText[2] = " <a href='"+ds.Rows[0].ID+"'>REPLY </a>" ;
arrCellText[3] = " <a href='"+ds.Rows[0].ID+"'>DELETE </a>";
var resulttable= "tab"+ds.Rows[0].Img_ID;//this is Table in Datelist.i named Table "tab+meassage ID"
var resulttr= "tr"+ds.Rows[0].Img_ID;
_tab = document.getElementById(resulttable) ;
_tr = document.getElementById(resulttr) ;
createRowCell(_tab, _tr, arrCellText) ;
}
}
return
}
function createRowCell(tab, tr, arrCellText)
{
trNew = tab.insertRow(0) ;
for(var i=0; i <tr.cells.length; i++)
{
//alert(arrCellText[i]);here respones values of every field.
var tdNew = trNew.insertCell() ;
var tnNew = document.createTextNode(arrCellText[i]) ;
tdNew.appendChild(tnNew) ;
}
}
but,"Table" and the page have no any responsing.no refusing,if i press F5.result will display.
if i post in a worry catalog,or there is a better catalog.plx tell me.thanks!!!
|
|
|
|
|
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Xml.Xsl;
using System.Text;
using System.Threading;
public class ExportToExcel
{
System.Web.UI.Page page;
System.Web.HttpResponse Response;
public ExportToExcel(System.Web.UI.Page page)
{
page = this.page;
Response = System.Web.HttpContext.Current.Response;
}
public void ExportDataToExcel(DataTable datatable, string[] Headers, string SourcePath, string DestinationPath)
{
int i, j;
string strSourceTemplate = "";
string strDestFileName = "";
string strHeaders = "";
string strRow = "";
System.Data.OleDb.OleDbConnection objXlsCon = null;
System.Data.OleDb.OleDbCommand objCmd;
try
{
objXlsCon = new System.Data.OleDb.OleDbConnection();
if (datatable.Rows.Count > 0)
{
strSourceTemplate = SourcePath;
strDestFileName = DestinationPath;
System.IO.File.Copy(strSourceTemplate, strDestFileName);
objXlsCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strDestFileName + ";Extended Properties=\"Excel 8.0;HDR=Yes;MAXSCANROWS=1;\";";
objXlsCon.Open();
objCmd = new System.Data.OleDb.OleDbCommand();
objCmd.Connection = objXlsCon;
for (i = 0; i < Headers.Length; i++)
{
strHeaders += Headers[i].ToString() + ",";
}
string s=datatable.Columns[0].ColumnName;
int k=0;
foreach (DataRow drow in datatable.Rows)
{
for (j = 0; j < datatable.Columns.Count; j++)
{
if(Headers.Length > k)
{
if(datatable.Columns[j].ColumnName == Headers[k].ToString())
{
if(drow[j].ToString() != "" )
{
strRow += drow[j].ToString() + "','";
}
else
{
strRow +="-'"+",'";
}
k++;
}
}
}
objCmd.CommandText = "Insert into [Sheet1$] (" + strHeaders.Substring(0, strHeaders.Length - 1) + ") values ('" + strRow.Substring(0, strRow.Length - 3) + "')";
objCmd.ExecuteNonQuery();
strRow = "";
j = 0;
k=0;
}
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
objCmd = null;
objXlsCon.Close();
}
}
public void Download(string strFileName, string SourceFolder)
{
string path = SourceFolder;
Response.AddHeader("Content-Disposition", "attachment; filename=" + strFileName + ".xls");
Response.ContentType = "application/ms-excel";
FileStream fs = null;
fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
byte[] data = new byte[fs.Length];
fs.Read(data, 0, (int)fs.Length);
fs.Close();
Response.BinaryWrite(data);
Response.End();
}
}
This is my cs file to export datagrid to Excel.
But this code is exporting total records
in to excel. I want to insert only 10 records.
Paging is there in the DataGrid,at a time i am
displaying 10 records.When i am giving Export
it must insert only 10 records.What should i
change in this code.Thanks in advance
|
|
|
|
|
Surely its obvious?
foreach (DataRow drow in datatable.Rows)
{.......
is going to read all the records. You need to control the loop a different way, either using a counter or
for (int ctr =0 ;ctr<10; ctr++)
{
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Hi,
This is what i had in mind.
Solution1
-Project1
-Default.aspx
-Project2
-UserControl\Usercontrol1.ascx
-Default.aspx
Now, what I need is to use Usercontrol1.ascx to Default.aspx in Project1.
Usercontrol1.ascx is used in local Default.aspx in Project2.
Also Project1 & Project2 are in the same solution under Solution1.
So anyone knows how to do this?
Thanks.
|
|
|
|
|
i think u need to add this usercontrol to both project
|
|
|
|
|