|
well nested controls means if u have a user control, within tht there is an other, n with the innerone there is another one and so on and in the fifth control u have an asp.net control. it would be difficult to make properties instead of tht method ,tht i've mentioned is quiete simple to me. i don't how do u find it. but i find it quite simple.
regards.
|
|
|
|
|
Hi,
Did this work at your side?
I have tried this but its giving me NullReferenceException.
I have a usercontrol "GetCategory.ascx" in that there is one gridview with id "gvSearchResult".
I put "GetCategory.ascx" in to "Parent1.ascx" then I put "Parent1.ascx" in to "Parent2.ascx".
I used "Parent2.ascx" in to my Text.aspx page.
and write the following code in the Page_Load event of "Text.aspx".
GridView gv = ( GridView )Parent2_1.FindControl( "gvSearchResult" );
Response.Write( gv.ID ); // On this line it gives me NullReferenceException. Means it could not find controls with "gvSearchResult" in Parent2_1 control on the page.
Can you tell me why is it like that or am I making any mistake?
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
hi,
well....
yes definitely u r committing mistakes.
first tell me tht when u execute
GridView gv = ( GridView )Parent2_1.FindControl( "gvSearchResult" );
above line, have u bound the gridview.
now, if u've bounded it, still u r commiting a mistake in the following line;
GridView gv = ( GridView )Parent2_1.FindControl( "gvSearchResult" )
the correctone is:
GridView gv=(GridView) Parent2_1.findcontrol("parent1").findcontrol("getcategory").findcontrol("gvSearchResult");
keep two things in mind.
u don't have to write the names infact there ID must be written given to findcontrol method.
and second thing is make sure ur datagrid is filled before u findit.
these are the two reasons which u need to correct...
hope it works.
regards.
|
|
|
|
|
Hi,
I am executing that line after binding the gridview in the usercontrol
and by the way there is no need to bind the gridview before you access it in your code because to bind gridview to any datasource you need to have an access to instance of gridview.
Try it!!!!!!!!!!!!!!!!
Your solution to find controls in the usercontrol is good but for that one should know about the IDs of all the controls and their types in the all the usercontrols.
What about making related properties whereever need in all the controls so that they can be used with without worrying about types and IDs of nested controls and the undelaying complaxity because properties are there for hide complexity only and improve the accessibility and readbility.
Think on it!!!!!!!!!!!!!!!!!!!!!!!
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
well the thing is....
fine u can access datagrid before using it. but before accessing any value from the grid it must contain something. fine i agree.
n as far as the second thing is concerned,
i find this way easy.
if u find, writing hundreds of lines of code, easy then there is no prob at all. i didn't say its wrong but for me atleast its tiring.
ne ways every buddy has his own logic and view. so wish u gud luck..
take carez
regards.
|
|
|
|
|
Hi,
You r right. Everybuddy has his own logic and view.
Good Luck to you too.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
1)u have to diclare a public propety in the usercontrol like
public string propertyname()
{
get
{
return textbox1.text;
}
set
{
textbox.text=value;
}}
2)refer it in the html view by making use of Registertag
<%@Register tagprefix="" tagname="" src=""%>
hope this will help u........or you can have a look athttp://www.codersource.net/asp_net_web_user_controls.html[^]
|
|
|
|
|
thanks for the reply...
but this is not the solution for my problem...
actually i have to get the textbox value into my aspx page codebehind...
Pradeep Reddy
|
|
|
|
|
Hi,
I have a datagrid for which i have implemented paging. If there are no records in the datagrid then i dont want the pagerstyle mode to be shown.
i.e. i dont want the page numbers to be shown if the datagrid is not having any values.
Thanks,
Riz
|
|
|
|
|
void BindListGrid()
{
ListGrid.DataSource=college.GetNewCollegeSubscription();
ListGrid.DataBind();
int ListRecordCount=college.GetNewCollegeSubscription().Tables[0].Rows.Count;
if(ListRecordCount==0)
{
ListGrid.PagerStyle.Visible=false;
}
else
{
ListGrid.PagerStyle.Visible=true;
}
}
i hope this will help u...
Pradeep Reddy
|
|
|
|
|
void BindGrid()
{
Grid.DataSource=ds();
Grid.DataBind();
int RecordCount=ds.Tables[0].Rows.Count;
if(RecordCount==0)
{
Grid.PagerStyle.Visible=false;
}
else
{
Grid.PagerStyle.Visible=true;
}
}
This will work for u.
Puneet Srivastava
|
|
|
|
|
Hey,
Thanks a lot for the solution
|
|
|
|
|
Hi, i'm new in asp.net and have this error:
Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load file or assembly 'ADODB' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 1: <%@ Page Language="VB" ValidateRequest="false" %>
Line 2: <%@ Assembly Name="ADODB" %>
Line 3: <%@ Import Namespace="ADODB" %>
Line 4: <%@ Import Namespace="System.Data" %>
Source File: /news.aspx Line: 2
Assembly Load Trace: The following information can be helpful to determine why the assembly 'ADODB' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
Alex
|
|
|
|
|
Hello,
It seems that the assembly ADODB is not in the correct directory.
Also, I did a quick google search about ADODB, it appears to be a PHP library. If it's the case, you cannot use it in .NET
Talal
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Of course you can use it. You need to put adodb.dll in your applications' bin folder. It is probably already on your computer (do a search fr it) or drop me an email and I'll send you it.
Fred
|
|
|
|
|
hi friend I am using asp.net 2.0 with ajax toolkit .
I am doing datagrid pagging using ajax.i have a file popup in my page
which popup file on mouse over it.
when i am chaing only pages my application runs fine
But if i am open file popup and then try to change page .
It gives error "state information is invalid for this page and might be coruppted "
not even goto page load
pls help me it's urgent
Thanks in advance
MAKARAND
|
|
|
|
|
How are you maintaining the state information in current application ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
how can i create asp.net with c# code.please send any information for beginers.
|
|
|
|
|
|
Go To
Http://www.goggle.com
Puneet Srivastava
|
|
|
|
|
Go To
Http://www.w3schools.com
Puneet Srivastava
|
|
|
|
|
Go To
www.w3schools.com
Puneet Srivastava
|
|
|
|
|
how to remove column from gridview.
i have mapp BLL to gridview.
i don't want to disply 2 columns in that
so how to delete it
vijaya
vijaya
|
|
|
|
|
Hi,
There is no way to delete column from gridview.
Better you make is invisible.
gv.Columns[colindex].Visible = false;
I hope this will help you.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
i have mapped BLL to datagrid;
gv.Columns[colindex].Visible = false;
gv.datasource = Countrylogic.getdata();
gv.databind();
will not make column invisible;
because gv.Columns.count =0;
moreover i added one checkbox to after that
gv.Columns.count =1;
so it will remove checkbox column;
vijaya
vijaya
|
|
|
|