|
Hi,
I have created user control called UserCtrl.ascs in my solution which includes two textboxes in that usercontrol and and also i have added the following code in .ascx.cs page.
public string pUser
{
get
{
return TextBox1.Text.Trim;
}
set
{
TextBox1.Text = value;
}
}
public string pPass
{
get
{
return TextBox2.Text.Trim;
}
set
{
TextBox2.Text = value;
}
I added that user control to my aspx page. Please tell me how to use that textboxes inside aspx.cs page.
Thanks in Advance,
Regards,
Prya
|
|
|
|
|
create object of that user control class, and and set the value of properties...
|
|
|
|
|
this.UserCtrl.TextBox1.value this way
|
|
|
|
|
As blue_arc said, you use user control from page codebehind same way as if it was standard ASP.NET web control.
Assuming you have in your aspx file:
<uc:userCtrl runat="server" id="myCtrl"/>
in codebehind do:
string password = myCtrl.pPass;
Is it clear?
You should not try to access textboxes directly, as it goes against encapsulation principle (hence I downvoted guy above me :P).
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
Hi,
Can any1 provide me ASP.NET 2.0 or 1.1 interview questions or FAQs????.. If u have compiled list then send it to ganesh_d1@yahoo.com
Thanx in advance.
|
|
|
|
|
I want it for ASP.NET with C#.
|
|
|
|
|
use google.. you will get faq related to the topic in abundance..
Best Regards,
Apurva Kaushal
|
|
|
|
|
hai,
anybody knows anything about whiteboard technology. how to use that in asp.net webapplications.
please give some tips
thanks in advance
sebastian
|
|
|
|
|
Hi everybody
I have used a datagrid in my form. and every thing is Ok.
I can see the items I want in datagrid but the problem is about paging.
I have set the paging to 5 ..it means the datagrid should show 5 items in page 1 and the next 5 items in the next page( page 2 ) and ...
but it doesnt work ... it shows the page but when I click on page 2 it already shows the items in page 1 ...
I mean just page 1 works ...what should I do?
whats wrong with properties or code?
please tell me ...
thank you very much.
|
|
|
|
|
Hope this helps u.
private void dgGrid_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
dgGrid.CurrentPageIndex = e.NewPageIndex ;
DataSet ds = GetEmployeeList();//Bind List again
}
|
|
|
|
|
hi it didnt work...
here is my code ... can u please tell me what is wrong with it ?
thanks alot.
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
FillDataGrid();
}
}
private void FillDataGrid()
{
cUpload upload=new cUpload();
bool Success;
dsUpload1=upload.GetAllUpload(out Success);
if(Success)
{
dgUpLoad.DataSource=dsUpload1.tblUpLoad;
}
dgUpLoad.DataBind();
}
private void dgUpload_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
cUpload upload=new cUpload();
bool Success;
dgUpLoad.CurrentPageIndex= e.NewPageIndex ;
dsUpload1=upload.GetAllUpload(out Success);
//Bind List again
}
|
|
|
|
|
What is out Success and dgUpLoad.DataSource=dsUpload1.tblUpLoad;??
U can dierctly bind datagrid with dataset.
|
|
|
|
|
Thats because I want to bind My datagrid to dataset which is connected to table name tblupload ...
the items which is shown in datagrid is the items in my table ( tblupload ) ...
So,If you have any suggestion please correct my code above and write it here...thanks alot
|
|
|
|
|
No need to that way.Try this:
Dim strSql as String
strsql = "Select * from tblupload"
'Open DB connection here
Dim dtad As SqlDataAdapter
Dim dtst As DataSet
dtst = New DataSet
dtad = New SqlDataAdapter(strsql, GetConnection)
'Close DB connection here
dtad.Fill(dtst)
DataGrid1.DataSource = dtst
DataGrid1.DataBind()
I think this much is enough to display the Datagrid.
|
|
|
|
|
1.the language I use is C#
2.I have problem with working numbers of pages not showing the grid.
thanks
|
|
|
|
|
Try this :
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
FillDataGrid();
}
}
private void FillDataGrid()
{
string strsql = "Select * from tblupload"
//Open DB Connection here
DataSet ds = con.GetDataSet(SQL,tableName);
DataGrid1.DataSource = ds;
DataGrid1.DataBind();
//Close DB Connection here
}
private DataSet GetDataSet(String sql)
{
string tableName = "tblupload";
SqlDataAdapter da = new SqlDataAdapter(sql, connectionStr);
da.Fill(ds, tableName);
return ds;
}
|
|
|
|
|
Hi All,
I have 2 combo, a textbox and a checkbox. On Add button Click event(which is outside the Gridview) I put all the values in datatable and then bind it the GridView.
I am creating dynamically columns for datatable and keeping them in Viewstate.I have two columns of edit and delete in Girdview.Now my problem is that when I click on edit image button which is in the Gridview Edit column I want to add the above combo ,textbox and checkbox in the gridview so that I can edit that row.
Also I need to delete the record.
Can anyone tell me how do I do this.
Thanks in advance.
-- modified at 5:12 Thursday 1st February, 2007
|
|
|
|
|
hi alll,
how can i get the ajaxToolkit:PopupControlExtender.
control to use in as.net 2.0 project.
pls help.
thanks in advance.
srinandan.
-- modified at 4:27 Thursday 1st February, 2007
|
|
|
|
|
Download the toolkit, add the DLL as a reference, add the control to the toolbox (right click->choose items, browse to the DLL). Hey presto....but then it would of been easier to read the instructions....
|
|
|
|
|
How to do load balancing in an application
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
|
|
|
|
|
|
Hi friends
i have bit probelm
my code is.
TextBox txt1 = new TextBox();<br />
foreach(Control txt in tbl.Controls)<br />
{<br />
if (txt is TextBox)<br />
{<br />
txt1 = (TextBox)Convert.ChangeType(txt, typeof(TextBox));<br />
txt1.Text = string.Empty;<br />
} <br />
<br />
<br />
}
tbl is my table in which i have many textboxes.
plz help me
its urgent.
thanks in advance
Pathan
|
|
|
|
|
Hi,
Is this not working?
txt1.Text = "";
|
|
|
|
|
hi atul
i have tried it too.
but not working
pathan
|
|
|
|
|
tbl.Controls only contains the controls directly contained by the table, in other words TableRows. These contain Cells, which contain the Textboxes. So either you find an easier way, like adding the Textboxes to a List, to do this or
<code>foreach (TableRow tr in tbl.Rows)
foreach (TableCell tc in tr.Cells)
foreach (Control txt in tc.Controls)
if (txt is TextBox)
{
((TextBox)txt).Text = String.Empty;
}</code>
|
|
|
|