Click here to Skip to main content
15,903,388 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionWorking with PDF. Pin
mani_iips16-Aug-07 21:21
mani_iips16-Aug-07 21:21 
QuestionHelp regarding refreshing a page. Pin
anu8116-Aug-07 21:18
anu8116-Aug-07 21:18 
AnswerRe: Help regarding refreshing a page. Pin
Mark Churchill16-Aug-07 21:28
Mark Churchill16-Aug-07 21:28 
GeneralRe: Help regarding refreshing a page. Pin
anu8116-Aug-07 21:37
anu8116-Aug-07 21:37 
GeneralRe: Help regarding refreshing a page. Pin
Michael Sync16-Aug-07 22:03
Michael Sync16-Aug-07 22:03 
GeneralRe: Help regarding refreshing a page. Pin
N a v a n e e t h16-Aug-07 22:34
N a v a n e e t h16-Aug-07 22:34 
AnswerRe: Help regarding refreshing a page. Pin
S A R I T H16-Aug-07 21:37
S A R I T H16-Aug-07 21:37 
QuestionMy page change event does not fire for first page. Pin
Anees Mitha16-Aug-07 21:09
Anees Mitha16-Aug-07 21:09 
Hi,

I am having a really wierd problem. My page change event does not fire for my first page. Whenever i click on page 1 from any page the page change event does not fire. But when i click on other pages the event is fired properly.

Following is the code.

Since i am generating the Bound columns dynamically i am calling the getdata() method in OnInit in order to avoid
eventvalidation problem.

public partial class User_Control_Generic_Grid_ctlGenDGSelecttest : System.Web.UI.UserControl
{

string ReportDetails = string.Empty;

protected string MyData
{
get { return Request.Form[getClientName(this.txtRptDetails)]; }
set { txtRptDetails.Text = value; }
}

String getClientName(Control ctrl)
{
String result = ctrl.ClientID.Replace("_", "$");
return (result);
}

protected override void OnInit(EventArgs e)
{


if (IsPostBack)
{

getdata();
}


}

protected void Page_Load(object s, EventArgs e)
{
if (!IsPostBack)
{
string ReportParams = (string)Context.Items[ReportConstants.ReportParams];

//Setting DataKeyField Value
string ReportName = string.Empty;

string[] rptDetails = ReportParams.Split('|');

int ParamCount = (ReportParams.Split('|').Length) - 1;
for (int i = 0; i <= ParamCount; i++)
{
string[] ParamsRpt = rptDetails[i].Split('=');

if (ParamsRpt[0] == ReportConstants.ReportName)
{
ReportName = ParamsRpt[1];
}

}

SqlConnection conSQL = new SqlConnection("server=test;uid=sa;pwd=password;database=northwind");

SqlCommand cmdSelect = new SqlCommand("WebGetReportDetails", conSQL);
cmdSelect.CommandType = CommandType.StoredProcedure;
cmdSelect.Parameters.Add(new SqlParameter("@ReportName", ReportName));

DataSet dstProducts = new DataSet();
SqlDataAdapter aptrProducts = new SqlDataAdapter(cmdSelect);

aptrProducts.Fill(dstProducts);

txtRptDetails.Text = ReportParams;
ReportDetails = ReportParams;

getdata();

}

}


public virtual void PageIndexChanged_GridView(object s, DataGridPageChangedEventArgs e)
{

DataGrid gv = (DataGrid)s;
gv.CurrentPageIndex = e.NewPageIndex;
getdata();

}

public void getdata()
{
DataSet ds = new DataSet();

string rptDetailstxt = this.MyData;
if (rptDetailstxt == null)
{
rptDetailstxt = txtRptDetails.Text;
}

GridReports objBO = new GridReports();
ds = (DataSet)objBO.GridData(rptDetailstxt);

foreach (DataColumn c in ds.Tables[0].Columns)
{
grdvwCheckbox.Columns.Add(CreateBoundColumns(c));
}

grdvwCheckbox.DataSource = ds;
grdvwCheckbox.DataBind();

}

public BoundColumn CreateBoundColumns(DataColumn c)
{
BoundColumn column = new BoundColumn();
column.DataField = c.ColumnName;
column.HeaderText = c.ColumnName.Replace("_", " ");
column.DataFormatString = setFormating(c);
column.ItemStyle.Wrap = false;

return column;
}

private string setFormating(DataColumn bc)
{
string dataType = null;
switch (bc.DataType.ToString())
{
case "System.Int32":
dataType = "{0:#,###}";
break;
case "System.Decimal":
dataType = "{0:c}";
break;
case "System.DateTime":
dataType = "{0:dd-mm-yyyy}";
break;
case "System.String":
dataType = "";
break;
default: dataType = "";
break;
}
return dataType;
}
}

Please feel free to revert in case of any clarification.

Thanks!

Regards,
Anees
AnswerRe: My page change event does not fire for first page. Pin
VanithaVasu16-Aug-07 22:39
VanithaVasu16-Aug-07 22:39 
GeneralRe: My page change event does not fire for first page. Pin
N a v a n e e t h16-Aug-07 23:55
N a v a n e e t h16-Aug-07 23:55 
AnswerRe: My page change event does not fire for first page. Pin
N a v a n e e t h16-Aug-07 23:52
N a v a n e e t h16-Aug-07 23:52 
GeneralRe: My page change event does not fire for first page. Pin
Anees Mitha17-Aug-07 0:18
Anees Mitha17-Aug-07 0:18 
GeneralRe: My page change event does not fire for first page. Pin
Anees Mitha17-Aug-07 0:59
Anees Mitha17-Aug-07 0:59 
QuestionHtml to Xml Conversion and viceversa Pin
ayurhdfkl16-Aug-07 21:01
ayurhdfkl16-Aug-07 21:01 
AnswerRe: Html to Xml Conversion and viceversa Pin
daniel__c16-Aug-07 21:08
daniel__c16-Aug-07 21:08 
GeneralRe: Html to Xml Conversion and viceversa Pin
ayurhdfkl16-Aug-07 21:14
ayurhdfkl16-Aug-07 21:14 
GeneralRe: Html to Xml Conversion and viceversa Pin
daniel__c16-Aug-07 21:21
daniel__c16-Aug-07 21:21 
GeneralRe: Html to Xml Conversion and viceversa Pin
ayurhdfkl16-Aug-07 22:54
ayurhdfkl16-Aug-07 22:54 
QuestionHow to clear browser's Cache. Pin
naresh51116-Aug-07 20:52
naresh51116-Aug-07 20:52 
QuestionDisplay image along with the grid view Pin
Sujit Mandal16-Aug-07 20:38
Sujit Mandal16-Aug-07 20:38 
AnswerRe: Display image along with the grid view Pin
N a r e s h P a t e l16-Aug-07 20:53
N a r e s h P a t e l16-Aug-07 20:53 
GeneralRe: Display image along with the grid view Pin
Sujit Mandal16-Aug-07 20:58
Sujit Mandal16-Aug-07 20:58 
GeneralRe: Display image along with the grid view Pin
N a r e s h P a t e l16-Aug-07 21:11
N a r e s h P a t e l16-Aug-07 21:11 
GeneralRe: Display image along with the grid view Pin
N a r e s h P a t e l16-Aug-07 23:01
N a r e s h P a t e l16-Aug-07 23:01 
GeneralRe: Display image along with the grid view Pin
Sujit Mandal17-Aug-07 2:47
Sujit Mandal17-Aug-07 2:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.