|
You won't be able to access the Repeater3 control from the ascx directly as a new one is created for each databound item.
If you handle the OnItemDataBound event on Repeater1 you'll be able to access the Repeater3 control using:
e.Item.FindControl("Repeater3")
|
|
|
|
|
Martin Jarvis wrote: You won't be able to access the Repeater3 control from the ascx directly
Why not? See below.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Thank you for the reply but still it didnt recognize Repeater3..
suchita
|
|
|
|
|
You have not bound the nested Repeater so of course it will not display anything.
<asp:Repeater ID="Repeater3" runat="server" DataSource='<%# ((SiteMapNode)Container.DataItem).ChildNodes %>'>
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Thank you for the reply but adding that line still couldn't recognize the Repeater3 ..
suchita
|
|
|
|
|
SayamiSuchi wrote: couldn't recognize the Repeater3
Please clarify what you mean by this.
The example was for a nested Sitemap, you will of course need to adjust it to your usage.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I am taking datasource from the dataset which i passed it to the repeater1.I also tried like this:
<asp:Repeater runat="server" id="Repeater1">
<HeaderTemplate>items<br /><br /></HeaderTemplate>
<ItemTemplate>
<b><%# DataBinder.Eval(Container.DataItem, "catagoryname") %></t>
<br><%# DataBinder.Eval(Container.DataItem, "catagorydescription") %>
<asp:Repeater ID="Repeater3" runat="server" DataSourceID="DataSourceMember">
<ItemTemplate>
<br>Items: <%# DataBinder.Eval(Container.DataItem,"ItemName")%></t></t></t><%# DataBinder.Eval(Container.DataItem, "Amount") %>
<br><%# DataBinder.Eval(Container.DataItem, "ItemDescription") %></br>
</ItemTemplate>
</asp:Repeater>
<asp:SqlDataSource ID="DataSourceMember" runat="server" ConnectionString="server=myComp;uid=sa;pwd=sa;database=ItemCat" SelectCommand="SELECT * FROM items where catID = '<%# DataBinder.Eval(Container.DataItem,"ID") %>'" \>
</ItemTemplate>
<separatortemplate>
<br />
<br />
<br />
</separatortemplate>
</asp:Repeater>
erros is :
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: The server tag is not well formed.
Source Error:
Line 193: </ItemTemplate>
Line 194: </asp:Repeater>
Line 195: <asp:SqlDataSource ID="DataSourceMember" runat="server" ConnectionString="server=myComp;uid=sa;pwd=sa;database=ItemCat" SelectCommand="SELECT * FROM items [ACN] Where catID = '<%# DataBinder.Eval(Container.DataItem,"ID") %>'" \>
Line 196:
suchita
modified on Monday, July 26, 2010 2:10 PM
|
|
|
|
|
Now we finally get to the issue, "Parser Error Message: The server tag is not well formed". You could have saved a few steps and gave this information at the beginning.
This is not the best way to accomplish this. You understand you are going to create a new SqlDatasource for each item in the parent list? Handle the ItemDataBound event of the parent repeater and assign the datasource, perferably from a cached source.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
itemDataBound event is like this right:
void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
RepeaterItem item = e.Item;
if ((item.ItemType == ListItemType.Item) ||
(item.ItemType == ListItemType.AlternatingItem))
{
Repeater3 = e.Item.FindControl("Repeater3");
DataRowView drv = (DataRowView)item.DataItem;
Repeater3.DataSource = drv.CreateChildView("category_item");
Repeater3.DataBind();
}
}
but if i do like this, it give error as below:
Repeater3 doesn't exits..
while ascx.cs code is
<asp:Repeater runat="server" id="Repeater1">
<HeaderTemplate>items<br /><br /></HeaderTemplate>
<ItemTemplate>
<b><%# DataBinder.Eval(Container.DataItem, "catagoryname") %></t>
<br><%# DataBinder.Eval(Container.DataItem, "catagorydescription") %>
<asp:Repeater ID="Repeater3" runat="server">
<ItemTemplate>
<br>Items: <%# DataBinder.Eval(Container.DataItem,"ItemName")%></t></t></t><%# DataBinder.Eval(Container.DataItem, "Amount") %>
<br><%# DataBinder.Eval(Container.DataItem, "ItemDescription") %></br>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
<separatortemplate>
<br />
<br />
<br />
</separatortemplate>
</asp:Repeater>
suchita
|
|
|
|
|
Repeater3 = e.Item.FindControl("Repeater3");
Of course it doesn't exist, what type is Repeater3? All you have is a name. You also understand FindControl needs to be cast to something useful?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
yes.
i did like this:
Repeater3 =(Repeater) e.Item.FindControl("Repeater3");
now i have another error shown.
The relation is not parented to the table to which this DataView points.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: The relation is not parented to the table to which this DataView points.
Source Error:
Line 120: Repeater2 = (Repeater)e.Item.FindControl("Repeater2");
Line 121: DataRowView drv = (DataRowView)item.DataItem;
Line 122: Repeater2.DataSource = drv.CreateChildView("CategoryToItem");
Line 123: Repeater2.DataBind();
Line 124: }
suchita
modified on Monday, July 26, 2010 4:38 PM
|
|
|
|
|
RTFM
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Sorry, I couldn't get that. Can you explain that please ?
I even included below code:
SqlCommand objCmd = new SqlCommand(query, cnx);
SqlDataAdapter objDA = new SqlDataAdapter(objCmd);
DataSet ds = new DataSet();
objDA.Fill(ds);
Repeater1.DataSource = ds;
Repeater1.DataBind();
DataColumn c1 = ds.Tables["category"].Columns["ID"];
DataColumn c2 = ds.Tables["Items"].Columns["CatID"];
dRel = new DataRelation("CategoryToItem", c1, c2);
ds.Relations.Add(dRel);
suchita
|
|
|
|
|
ROFL A+ man A+ ...
If at first you don't succeed ... post it on The Code Project and Pray.
|
|
|
|
|
I am doing localization in my application.
How can I localize data, which is populating from database.
That is, If I am putting some values in database which are predefined and is set explicitly .If I am populating this data in my Chinese culture, English characters are appearing.
Please help in same.
Thanks.
|
|
|
|
|
|
Hello All,
I am doing Localization in my application, and using following script for Post Date Alert for making sure user does not select date earliar than today..
Problem is if I login as Chinese culture or other except English, I choose date from calander which is greater than today, it gives popup and then display Todays date in English.
I am using EnableScriptGlobalization= "true" in ToolkitScriptManager so as calander will display in respective culture.
function checkDate(sender, args) {
if (sender._selectedDate > new Date()) {
alert("Alert");
sender._selectedDate = new Date();
sender._textbox.set_Value(sender._selectedDate.format(sender._format));
}
}
Thanks.
Shreshtha
|
|
|
|
|
Afer I moved my code to new machine am getting this error "System.Security.Policy.PolicyException: Required permissions cannot be acquired."
|
|
|
|
|
Do any of these[^] apply to you?
|
|
|
|
|
thanks for your reply.
still am facing the same issue.
|
|
|
|
|
what have you tried? When do you get the error? how does it exhibits?
|
|
|
|
|
<trust level="Full" originUrl="" />
is already available in my application and am getting this error only on some of the pages in my application.
Error Message:
[PolicyException: Required permissions cannot be acquired.]
System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission) +7606807
System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission) +57
[FileLoadException: Could not load file or assembly 'WebChart, Version=1.1.1.4, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43
System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +127
System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +142
System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46
[ConfigurationErrorsException: Could not load file or assembly 'WebChart, Version=1.1.1.4, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +613
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +203
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +105
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir) +163
System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors) +53
System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir, VirtualPath virtualDir, Boolean ignoreErrors) +175
System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +86
System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +261
System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +101
System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +126
System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +62
System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +33
System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String requestType, String virtualPath, String path) +37
System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +307
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
modified on Monday, July 26, 2010 11:28 AM
|
|
|
|
|
I am using asp.net with c# and sql server. well I have some syntax error problem. my code is:
<asp:Repeater runat="server" id="Repeater1">
<HeaderTemplate>Items<br /><br /></HeaderTemplate>
<ItemTemplate>
<b><%# DataBinder.Eval(Container.DataItem, "CatName") %></t>
<asp:HiddenField ID="HiddenField1" runat="server" value='<%# DataBinder.Eval(Container.DataItem,"ID") %>' />
<asp:Repeater id="Repeater2" runat="server" DataSourceID="AccessDataSourceMembers">
<ItemTemplate>
<tr>
<br><%# DataBinder.Eval(Container.DataItem, "ItemName") %></br>
</tr>
</ItemTemplate>
</asp:Repeater>
<asp:SqlDataSource ID="AccessDataSourceMembers" runat="server" ConnectionString="server=myComp;uid=sa;pwd=sa;database=catItem" SelectCommand="SELECT * FROM items Where cat_ID = ?">
<SelectParameters>
<asp:ControlParameter Name="ID" ControlID="HiddenField1" PropertyName="Value" Type="string" />
</SelectParameters>
</asp:SqlDataSource>
</ItemTemplate>
<separatortemplate>
<br />
<br />
<br />
</separatortemplate>
</asp:Repeater>
and the error it is showing is:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near '?'.
Source Error:
Line 1197: objDA.Fill(ds);
Line 1198: Repeater1.DataSource = ds;
Line 1199: Repeater1.DataBind();
Line 1200:
Line 1201:
Note:If I do not use the nested repeater, it is working fine. So Can anyone tell me why is that error and how to get out of it??
suchita
|
|
|
|
|
SayamiSuchi wrote: SELECT * FROM items Where cat_ID = ?
it is complaining about your query. Are you sure that is what you want.
|
|
|
|
|
isn't the query was right ? I am new to repeater template tool and i am trying to use nested repeater. it gave those errors.
suchita
|
|
|
|
|