|
Actually why you were getting the error because you were not been able to get the control and then was using it that why you getting that object reference.. error.
In you event just set the reference for the dropdownlist and check whether it works or not.
suppose this your method:
public void Test(object sender, System.EventArgs e)
{
DropDownList list = (DropDownList)sender;
string hh = list.SelectedItem.ToString(); //to get the selected string.
}
Best Regards,
Apurva Kaushal
|
|
|
|
|
thank u sir, i got it
Pradeep Reddy
|
|
|
|
|
always welcome..
BTW one more thing don't call me sir, apurva will be ok.
Best Regards,
Apurva Kaushal
|
|
|
|
|
public void aa(object sender,System.EventArgs e)
{
DropDownList dl=(DropDownList)sender;
ss=dl.SelectedValue.ToString();----->this is working fine
TextBox tb=(TextBox)DataGrid1.FindControl("TextBox1");
tb.Text=ss;------->this is giving error
}
-- modified at 1:13 Tuesday 12th September, 2006
Pradeep Reddy
|
|
|
|
|
You can't get the textbox(which is inside the datagrid) like this. You need to have the find the index and then to find the control.
Probably first get the datagrid item like this:
TableCell cell = list.Parent as TableCell;<br />
DataGridItem item = cell.Parent as DataGridItem;
then you try to find the textbox control in it.
Best Regards,
Apurva Kaushal
|
|
|
|
|
TextBox tb1,tb2;
DropDownList dl1,dl2;
dl1=(DropDownList)sender;
string ss=dl1.SelectedValue.ToString();
tb1=(TextBox)DataGrid1.Items[0](i was missing this).FindControl("TextBox3");
tb1.Text=ss;
thank u i got the solution
Pradeep Reddy
|
|
|
|
|
Best Regards,
Apurva Kaushal
|
|
|
|
|
If I am not wrong, you have added this drop down in the edit Item template of Datagrid. What you can do is, You can go to the HTML source code and where there you have added this Edit Item Template you can add an event for dropdown in the HTML code itself.
<asp:dropdownlist id="DropDownList1" onselectedindexchanged="DropDownList1_SelectedIndexChanged" runat="server">
Regards,
Amit Kumar
HDISM, PGDCA, MCP, MCAD, MCSD
amit_chikara2002@hotmail.com
|
|
|
|
|
yes your right i added dropdownlist in edit item template.
how to add event i dont know plz tyell me the syntax
Pradeep Reddy
|
|
|
|
|
How to invoke the event in java script for submit button even though the button was disabled.
Jey
|
|
|
|
|
You can't activate a button that is disabled. You have to enable it first.
If you just want to post the form, you can use the submit method on the form.
---
b { font-weight: normal; }
|
|
|
|
|
Hi
Dear Friends ,
We want to learn Ajax , but first we want to now what it is exactly .
If Ajax is a new method in asp.net 2.0 programming or it is some controls or .DLL for using in web pages (VisualStudio .net 2005 VB) that we must register.
Please Introduce good refrences about these topics.
ATTENTION :
PLEASE DON`T ANSWER ME ------ CIWIZO --------
Thank you so much
Best Regards
Hussein Madani Ghomi
- h_madani_gh@yahoo.com
- Madani@SatrapTeam.ir
(+98-912-5577-832)
|
|
|
|
|
Hi Hussein,
[^]
hope it will be easy to know about ajax.
With Regards
Satips
|
|
|
|
|
Hi All,
I have developed an application using ASP.Net 2003 with .Net Framework 1.1.
But when i test application on .NetFramework 2.0 some pages crashes showing
Parser Error Message: Ambiguous match found.
Source Error:
Line 1: <%@ Page language="c#" Codebehind="ChangePassword.aspx.cs" AutoEventWireup="false" Inherits="TestApp.ChangePassword" %>
Line 2:
Line 3:
What could be the problem?
Praveen
-- modified at 2:59 Friday 6th October, 2006
|
|
|
|
|
There is also a built-in control ChangePassword in the ASP.NET 2.0, you may consider replace it with another name, and the Codebehind attribute is depricated in the version 2.0.
|
|
|
|
|
I have 2 Repeaters with ProductCategory and ProductDetail Architecture..
i.e master detail
Wot i want to do is ... enable the paging as a whole rather than ProductCategory or ProductDetail .. Here is sample code for it
strSQL = "SELECT ProductID, ShortDesc, LongDesc, SubCategoryID, PictureUrl, ProductCatID, DataSheetUrl " & _<br />
" FROM dbo.Products ORDER BY ProductID"<br />
'& Request.QueryString("subid")<br />
strSqlMain = "SELECT ProductCatID, Description, SubCategoryID FROM dbo.ProductCategory Where SubCategoryID=" & Request.QueryString("subid")<br />
clsCon.MakeDataSet(strSQL, dsProduct)<br />
clsCon.MakeDataSet(strSqlMain, ds)<br />
ds.Tables(0).TableName = "Main"<br />
ds.Tables.Add(dsProduct.Tables(0).Copy())<br />
ds.Tables(1).TableName = "Products"<br />
Dim str1(0) As String<br />
Dim str2(0) As String<br />
Dim dr As DataRelation = New DataRelation("ProductCat", ds.Tables("Main").Columns("ProductCatID"), ds.Tables("Products").Columns("ProductCatID"), False)<br />
ds.Relations.Add(dr)<br />
rptCategory.DataSource = ds<br />
rptCategory.DataBind()<br />
clsCon.sqlConnection.Close()
And the ItemDataBound Event of Master Repeater is
Protected Sub BindChild(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs)<br />
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then<br />
If (CType(e.Item.DataItem, DataRowView).CreateChildView("ProductCat")).Count > 0 Then<br />
Dim rpt As Repeater = e.Item.Controls(3)<br />
Dim dsPaged As New PagedDataSource<br />
dsPaged.DataSource = (CType(e.Item.DataItem, DataRowView).CreateChildView("ProductCat"))<br />
dsPaged.AllowPaging = True<br />
dsPaged.PageSize = 7<br />
dsPaged.CurrentPageIndex = CurrentPage<br />
lblCurrent.Text = "Page: " & (CurrentPage + 1).ToString & " of " & _<br />
dsPaged.PageCount.ToString<br />
lblPrevious.Enabled = Not dsPaged.IsFirstPage<br />
lblNext.Enabled = Not dsPaged.IsLastPage<br />
rpt.DataSource = dsPaged<br />
rpt.DataBind()<br />
End If<br />
End If<br />
End Sub
now problem is It makes the Paging enable on Product Repeater meanz .. if i have a Categories like CAT-A CAT-B,CAT-C
and all of these categories has 10 items each .. then paging will work as
first page will populate with 7 records of A,B,C, each .. and on pressing Next link it will show rest of records of each category ..
eg
CAT-A
a
b
c
d
e
f
g
CAT-B
ba
bb
bc
|
|
bg
|
|
|
so on
on next page
CAT-A
h
i
j
CAT-B
bh
bi
bj
|
|
|
so on
but i want it to work as
First Page should show CAT-A with 7 records
on pressing next it should show Rest of 3 records for CAT-A and ultimately start CAT-B with 5 records and so on ..
LIKE
CAT-A
a
b
c
d
e
f
g
on next page
h
i
j
CAT-B
ba
bb
bc
bd
R A M
|
|
|
|
|
hi this is senthil from chennai i want know how to fetch top 3 rank in our students database
senthil
|
|
|
|
|
you can use the query top 3 in your query to get the desired result.
BTW this you could have better put in the ADO and SQL forum.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Write this
select Top 3 * from students order by Rank
Regards,
Amit Kumar
HDISM, PGDCA, MCP, MCAD, MCSD
amit_chikara2002@hotmail.com
|
|
|
|
|
Dear Friends,
Hi
I want to include a javascript functions file in master,and then use those
functions in content pages,but it is not possible,It were working properly
before using master content page,I mean when all my code was in one page.
I appresiate anyone who can help
thanks.
zahra yousefi
yousefi105@yahoo.com
|
|
|
|
|
Define not working.
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Hi there,
That's possible that you can link to a javascript file with some functions in the master page so that you can use them in the content page. I'm afraid that there's something wrong in your case, so you might be more specific how you use the client side file in the master page.
|
|
|
|
|
I know it seems like a silly question and a security risk.. but i could swear I caught a glimpse of an article recently about how to do this... and I cant find it in the CP articles.
Is it possible? and could anyone point me in the right direction please ?
|
|
|
|
|
Java or ActiveX.
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Hi
1- How to use java script in master page at asp .net 2.0 ?
2- How can i make ATLAS or AJAX control ?
Best Regards
Hussein Madani Ghomi
- h_madani_gh@yahoo.com
- Madani@SatrapTeam.ir
(+98-912-5577-832)
|
|
|
|