|
How you are calling the JavaScript function at client side? It should be like 'return alertOnBadSelection();' Make sure that AutoPostback property is true.
*jayakrishnan
|
|
|
|
|
Thanks for replying me.
i am calling alertOnBadSelection() this function on onchange="return alertOnBadSelection();"like that.
if it is working fine for wrong selection,
but when i make right selection it not postback page.
dropdown OnSelectedIndexChanged event not fire.
can u hepl me on it.
thanks
|
|
|
|
|
I have this friend asking me how to add a blank row in datalist control. I tried some stuff using a default item template (literal html <td<) and found out that it indeed does not display the newly inserted blank row. This is because the new inserted row with blank contents ("" or " ") will be translated to <td></td> in HTML which in most browser will not show anything even a place holder. To solve this, you have two options:
The first one is to modify the ItemTemplate to use a <asp:TextBox /> or <asp:Label /> instead of literal <td></td> control. You can do this by replacing the Item Template section under the <asp:DataList... with this one:
<ItemTemplate>
<asp:TextBox BorderColor="Gray"
BorderWidth="1" BorderStyle="Solid"
id="Text1" runat="server"
Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>' />
<!-- <td><%# DataBinder.Eval(Container.DataItem, "Name") %></td> -->
</ItemTemplate>
Another option is that instead of adding a row that contains nothing, add a row in which at least one column contains a string with value " ". So that when the DataList control is translated to HTML the resulting translation will be <td> </td> which will be visible in the browser. Try the code below:
private void addBlankRow()
{
DataTable dt = (DataTable)DataList1.DataSource;
DataRow dr = dt.NewRow();
dr["Name"] = " ";
dt.Rows.Add(dr);
dt.AcceptChanges();
DataList1.DataBind();
}
Good Luck!
-Ross Brigoli
modified on Friday, October 3, 2008 3:59 AM
|
|
|
|
|
hello
i have created a fileupload at runtime...now i want to set its file from code...but its showing error that its read only...
FileUpload fl = new FileUpload();
fl.FileName="D://pic//bullet.gif";
fl.SaveAs(pic_path1);
please someone help how to set the file name in fileupload at runtime...
Thanks
|
|
|
|
|
Yeah... this is obviously for security reasons... You cannot initiate a file upload from within the website. The user must select a file.
|
|
|
|
|
|
Using MySql as DataSource for SqlDataSource ASP.NET 2.0 object I obtain the following
error:
"Unable to find the requested .Net Framework Data Provider. It may not be installed."
I have hosted the aspx page on easycgi
Please tell me how to solve this issue
thanks and regards
If You win You need not Explain............
But If You Loose You Should not be there to Explain......
|
|
|
|
|
The required assemblies for connecting MySql server may not be there in your server. You have to contact your hosting provider(easycgi) and sort out those issues. First make sure that your hosting plan will support MySql.
*jayakrishnan
|
|
|
|
|
Krazy Programmer wrote: Unable to find the requested .Net Framework Data Provider. It may not be installed
Which provider are you using for MySQL? Make sure provider assemblies are uploaded.
|
|
|
|
|
MySql.Data.MySqlClient is the provider
i am having the dll in bin also
and I am able to carry out transactions like reading data and inserting data , The only problem is while connecting it to a Gridview using the sqldatasource
Is that some plugins need to be installed on server ?
anyway thanks for the suggestions
If You win You need not Explain............
But If You Loose You Should not be there to Explain......
|
|
|
|
|
I have to upload 300000 Records from Sql Server to Oracle database using web page in Asp.net,
I was written logic, every records imported fine,
The Problem is, its taking 2 hours to upload just 17000 Records and then Asp.net breaks the loop.
Please give me the suggestion, How it can be made faster.
Regards,
Govind Bhanushali.
|
|
|
|
|
Ghehe, you need to give us loads of more information... You're question is like... 'My car is not working, what's going on?'
|
|
|
|
|
Please describe in detail
Cheers!!
Brij
|
|
|
|
|
HI Guyz
i'm creating dynamic texboxes in a tableCell and adding the table to a place holder
i'm trying to find the control so that i can use it to save data written in the texboxes,heres my code.
why cant i find the controls?
//i always get txtCtrl = null at thi point
//i used tblServer.FindControl and PlaceHolder1.FindControl, none work..
protected void btnUpdate_Click(object sender, EventArgs e)
{
for (int i = 0; i <= tblServer.Rows.Count; i++)
{
TextBox txtCtrl = (TextBox)tblServer.FindControl("txtbox" + (i + 1));
if (txtCtrl != null)
{
MessageBox.Show("txtCtrl")
}
}
}
private void CreateDynamicControls(string serverID)
{
int tblRows = Rows;
int tblCols = Columns;
tblServer = new Table();
int i = 0;
DataTable tblFields = GetData(server);
foreach (DataRow rowField in tblFields.Rows)
{
tr = new TableRow();
tcFields = new TableCell();
Label lblFields = new Label();
lblFields.Width = 60;
lblFields.Text = rowField["fieldName"].ToString();
tcFields.Controls.Add(lblFields);
tr.Cells.Add(tcFields);
DataTable tblFieldData = GetFieldData(serverID);
foreach (DataRow row in tblFieldData.Rows)
{
string txtName = "txtbox" + (i + 1);
tcFieldData = new TableCell();
TextBox txtData= new TextBox();
txtData.ID = txtName;
tcFieldData.Controls.Add(txtData);
tr.Cells.Add(tcFieldData);
i++;
}
tblServer.Rows.Add(tr);
}
PlaceHolder1.Controls.Add(tblServer);
ViewState["dynamictable"] = true;
}
|
|
|
|
|
from what I see you create the table dynamically, so maybe you should first find the table with the FindControl method and only after that the TextBox...
|
|
|
|
|
Thanks dude, that doesn't work either...
|
|
|
|
|
how do you search for the dynamic table?
I didn't see any ID for the table set anywhere... do you set it somewhere?
try to set the ID ... tblServer.ID = "tableID";
and then search for the table using:
Table tblServer = (Table)PlaceHolder1.FindControl("tableID");
this is what I would try
hope it helps.
|
|
|
|
|
it's not in the code i pasted,i tried it after your first reply,and i tried it again,
Table tblCtrl = (Table)PlaceHolder1.FindControl("tableID") returns null.
|
|
|
|
|
strange...
if it's not to long try to post your code to see what you're doing.
I don't know what else to tell you now
Andrei
|
|
|
|
|
Dude i'm also confused
heres my code:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Collections;
public partial class NewServerConfig : System.Web.UI.Page
{
DataRow odr;
Table tblServer = new Table();
string FieldName = "";
TableRow tr = new TableRow();
TableCell tcFields = new TableCell();
TableCell tcFieldData = new TableCell();
string server;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["LogedInID"] != null)
{
server = Request["id"].ToString();
tblServer.ID = "tblid";
int tblRows = Rows;
int tblCols = Columns;
tblServer = new Table();
PlaceHolder1.Controls.Add(tblServer);
if (!Page.IsPostBack)
{
CreateDynamicControls(server);
}
}
else
{
Response.Redirect("login.aspx");
}
}
protected int Rows
{
get
{
return ViewState["Rows"] != null ? (int)ViewState["Rows"] : 0;
}
set
{
ViewState["Rows"] = value;
}
}
protected int Columns
{
get
{
return ViewState["Columns"] != null ? (int)ViewState["Columns"] : 0;
}
set
{
ViewState["Columns"] = value;
}
}
private void CreateDynamicControls(string serverID)
{
int tblRows = Rows;
int tblCols = Columns;
tblServer = new Table();
tblServer.ID = "tblid";
int i = 0;
DataTable tblFields = GetData(server);
foreach (DataRow rowField in tblFields.Rows)
{
tr = new TableRow();
tcFields = new TableCell();
Label lblFields = new Label();
lblFields.Width = 60;
lblFields.Text = rowField["fieldName"].ToString();
tcFields.Controls.Add(lblFields);
tr.Cells.Add(tcFields);
DataTable tblFieldData = GetFieldData(serverID);
foreach (DataRow row in tblFieldData.Rows)
{
string txtName = "txtbox" + (i + 1);
tcFieldData = new TableCell();
TextBox txtData = new TextBox();
txtData.ID = txtName;
tcFieldData.Controls.Add(txtData);
tr.Cells.Add(tcFieldData);
i++;
}
tblServer.Rows.Add(tr);
}
tblServer.ID = "tableID";
PlaceHolder1.Controls.Add(tblServer);
ViewState["dynamictable"] = true;
}
DataTable GetData(string strid)
{
string sql = "SELECT tFields.fieldName, tFields.id FROM tFields INNER JOIN tRelServerFields ON tFields.id = tRelServerFields.tFieldsFKid WHERE (tRelServerFields.tServerFKid = @serverID)";
SqlConnection oCon = new SqlConnection(DatabaseConnection.ConnectionString);
SqlCommand cmd = new SqlCommand(sql, oCon);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@serverID ", Convert.ToInt32(strid));
DataTable tblData = new DataTable();
new SqlDataAdapter(cmd).Fill(tblData);
return tblData;
}
DataTable GetFieldData(string strFieldID, string serverID)
{
string sql = "Select fieldData,id from tRelServerFields where tServerFKid = @serverID and tFieldsFKid= @fieldsID ";
SqlConnection oCon = new SqlConnection(DatabaseConnection.ConnectionString);
SqlCommand cmd = new SqlCommand(sql, oCon);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@serverID ", serverID);
cmd.Parameters.AddWithValue("@fieldsID ", strFieldID);
DataTable tblData = new DataTable();
new SqlDataAdapter(cmd).Fill(tblData);
return tblData;
}
DataTable GetFieldData(string strid)
{
string sql = "Select id from tServer where id = @serverID ";
SqlConnection oCon = new SqlConnection(DatabaseConnection.ConnectionString);
SqlCommand cmd = new SqlCommand(sql, oCon);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@serverID ", Convert.ToInt32(strid));
DataTable tblData = new DataTable();
new SqlDataAdapter(cmd).Fill(tblData);
return tblData;
}
protected void Button1_Click(object sender, EventArgs e)
{
Hashtable ht;
odr = (DataRow)Session["ClientLogon"];
ht = new Hashtable();
ht.Add("fieldName", txtNewField.Text);
DataAccessLayer.PopulateData("tFields", ht);
}
protected void Button2_Click(object sender, EventArgs e)
{
SaveFieldname();
CreateDynamicControls(server);
}
DataTable GetFieldid(string strName)
{
string sql = "select id from tFields where fieldName = @fieldName ";
SqlConnection oCon = new SqlConnection(DatabaseConnection.ConnectionString);
SqlCommand cmd = new SqlCommand(sql, oCon);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@fieldName ", strName);
DataTable tblData = new DataTable();
new SqlDataAdapter(cmd).Fill(tblData);
return tblData;
}
public void saveServerField(string strid)
{
Hashtable ht;
odr = (DataRow)Session["ClientLogon"];
ht = new Hashtable();
ht.Add("tServerFKid", Convert.ToInt32(Request["id"]));
ht.Add("tFieldsFKid", Convert.ToInt32(strid));
DataAccessLayer.PopulateData("tRelServerFields", ht);
}
public void SaveFieldname()
{
Hashtable ht;
ht = new Hashtable();
ht.Add("fieldName", txtNewField.Text);
DataAccessLayer.PopulateData("tFields", ht);
FieldName = txtNewField.Text;
DataTable dt = GetFieldid(FieldName);
string newFieldid = "";
foreach (DataRow dr in dt.Rows)
{
newFieldid = dr["id"].ToString();
}
saveServerField(newFieldid);
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
for (int i = 0; i <= tblServer.Rows.Count; i++)
{
Table tblServer1 = (Table)PlaceHolder1.FindControl("tblid");
TextBox txtCtrl = (TextBox)tblServer1.FindControl("txtbox" + (i + 1));
if (txtCtrl != null)
{
Button2.Text = txtCtrl.Text;
}
}
}
}
|
|
|
|
|
I guess that your problem may be in the Page_Load method:
protected void Page_Load(object sender, EventArgs e)
{
if (Session["LogedInID"] != null)
{
server = Request["id"].ToString();
tblServer.ID = "tblid";
int tblRows = Rows;
int tblCols = Columns;
tblServer = new Table();
PlaceHolder1.Controls.Add(tblServer);
if (!Page.IsPostBack)
{
CreateDynamicControls(server);
}
//CreateDynamicControls(server);
}
else
{
Response.Redirect("login.aspx");
}
}
you first set the ID property of the table and then you instantiate a new table so the ID is lost ... I did something similar in a
test project:
Table tblServer = new Table();
protected void Page_Load(object sender, EventArgs e)
{
tblServer.ID = "tblid";
tblServer = new Table();
Response.Write(tblServer.ID);
}
and there is no output from the Response.Write method
try to set your ID again after the tblServer = new Table(); line
Andrei
|
|
|
|
|
still no luck , i noticed that tblServer.Rows.Count = 0 even though the table i dynamically created has about 4 rows...when i click the button,tblserver is null.. i'm changed my code a little,i now create the new instance in the method instead if page load,i thought that will help..
|
|
|
|
|
It Works
All i had to do was pass the form as a paremeter eg:
protected void Button3_Click(object sender, EventArgs e)
{
searchDynamicControl(this);
}
private void searchDynamicControl(Control parent)
{
......some code here
}
|
|
|
|
|
I have one doubt ... how to use Reporting service in Asp.net 2005..
J. Prabu
|
|
|
|
|
Reporting Services
SSK.
Anyone who says sunshine brings happiness has never danced in the rain.
|
|
|
|