Hi,
I have this code in my ASP.NET and I want to convert it to C# (code behind)
<asp:Repeater id="subCategory Repeater" runat="server">
<ItemTemplate >
<ul>
<li>
<asp:HyperLin k id="subCategory HyperLink" runat="server" NavigateUrl='<% #
"subcategory.as px?subcategoryi d=" +
Convert.ToStrin g(DataBinder.Ev al(Container.Da taItem, "id")) %>'>
<%# Convert.ToStrin g(DataBinder.Ev al(Container.Da taItem, "name")) %>
</asp:HyperLink>
</li>
</ul>
</ItemTemplate>
</asp:Repeater>
And this is my code behind:
private void subCategoryName (SqlString categoryId) {
subcat.Category Id = categoryId.ToSq lDecimal();
DataTable dataTable = subcat.SelectAl lWcategoryIdLog ic();
subCategoryRepe ater.DataSource = dataTable;
subCategoryRepe ater.DataBind() ;
}
Any help ?
thanks 3 2696
Rename your old file as .txt and bring it into the project as an existing
item.
Load the .txt file in the IDE and use it as a reference.
Load a new form, add the same type of controls to the new form that were
used in the now renamed .txt file, modify the property names of the controls
to match those in the .txt file and then copy reusable source from the .txt
file into the new form where it is needed in the .aspx or the .cs
code-behind.
-- or --
you have to write the declaration and signature for each control in the
code-behind yourself.
I think my suggested approach to rename and reuse is easier and fastest.
--
<%= Clinton Gallagher
METROmilwaukee "Regional Information Services"
NET csgallagher AT metromilwaukee. com
URL http://clintongallagher.metromilwaukee.com/
"Thubaiti" <Th******@discu ssions.microsof t.com> wrote in message
news:78******** *************** ***********@mic rosoft.com... Hi,
I have this code in my ASP.NET and I want to convert it to C# (code
behind) <asp:Repeater id="subCategory Repeater" runat="server"> <ItemTemplate > <ul> <li> <asp:HyperLin k id="subCategory HyperLink" runat="server" NavigateUrl='<% # "subcategory.as px?subcategoryi d=" + Convert.ToStrin g(DataBinder.Ev al(Container.Da taItem, "id")) %>'> <%# Convert.ToStrin g(DataBinder.Ev al(Container.Da taItem, "name")) %> </asp:HyperLink> </li> </ul> </ItemTemplate> </asp:Repeater>
And this is my code behind:
private void subCategoryName (SqlString categoryId) { subcat.Category Id = categoryId.ToSq lDecimal(); DataTable dataTable = subcat.SelectAl lWcategoryIdLog ic();
subCategoryRepe ater.DataSource = dataTable; subCategoryRepe ater.DataBind() ; }
Any help ?
thanks
when I wrote this code, there is a compiler error about "Container" ?!
Convert.ToStrin g(DataBinder.Ev al(Container.Da taItem, "name"));
Is there any way to convert "ONLY" this statement to code behind ??
<%# Convert.ToStrin g(DataBinder.Ev al(Container.Da taItem, "name")) %>
Thanks...
"clintonG" wrote: Rename your old file as .txt and bring it into the project as an existing item.
Load the .txt file in the IDE and use it as a reference.
Load a new form, add the same type of controls to the new form that were used in the now renamed .txt file, modify the property names of the controls to match those in the .txt file and then copy reusable source from the .txt file into the new form where it is needed in the .aspx or the .cs code-behind.
-- or --
you have to write the declaration and signature for each control in the code-behind yourself.
I think my suggested approach to rename and reuse is easier and fastest.
-- <%= Clinton Gallagher METROmilwaukee "Regional Information Services" NET csgallagher AT metromilwaukee. com URL http://clintongallagher.metromilwaukee.com/
"Thubaiti" <Th******@discu ssions.microsof t.com> wrote in message news:78******** *************** ***********@mic rosoft.com... Hi,
I have this code in my ASP.NET and I want to convert it to C# (code behind) <asp:Repeater id="subCategory Repeater" runat="server"> <ItemTemplate > <ul> <li> <asp:HyperLin k id="subCategory HyperLink" runat="server" NavigateUrl='<% # "subcategory.as px?subcategoryi d=" + Convert.ToStrin g(DataBinder.Ev al(Container.Da taItem, "id")) %>'> <%# Convert.ToStrin g(DataBinder.Ev al(Container.Da taItem, "name")) %> </asp:HyperLink> </li> </ul> </ItemTemplate> </asp:Repeater>
And this is my code behind:
private void subCategoryName (SqlString categoryId) { subcat.Category Id = categoryId.ToSq lDecimal(); DataTable dataTable = subcat.SelectAl lWcategoryIdLog ic();
subCategoryRepe ater.DataSource = dataTable; subCategoryRepe ater.DataBind() ; }
Any help ?
thanks
Google: "Container.Data Item" produced [1],[2] which may help you understand
what needs to be done.
--
<%= Clinton Gallagher
METROmilwaukee "Regional Information Services"
NET csgallagher AT metromilwaukee. com
URL http://clintongallagher.metromilwaukee.com/
[1] http://weblogs.asp.net/rajbk/archive...20/188868.aspx
[2] http://www.learnvisualstudio.net/vid...r_DataItem.htm
"Thubaiti" <Th******@discu ssions.microsof t.com> wrote in message
news:A3******** *************** ***********@mic rosoft.com... when I wrote this code, there is a compiler error about "Container" ?!
Convert.ToStrin g(DataBinder.Ev al(Container.Da taItem, "name"));
Is there any way to convert "ONLY" this statement to code behind ??
<%# Convert.ToStrin g(DataBinder.Ev al(Container.Da taItem, "name")) %> Thanks...
"clintonG" wrote:
Rename your old file as .txt and bring it into the project as an
existing item.
Load the .txt file in the IDE and use it as a reference.
Load a new form, add the same type of controls to the new form that were used in the now renamed .txt file, modify the property names of the
controls to match those in the .txt file and then copy reusable source from the
..txt file into the new form where it is needed in the .aspx or the .cs code-behind.
-- or --
you have to write the declaration and signature for each control in the code-behind yourself.
I think my suggested approach to rename and reuse is easier and fastest.
-- <%= Clinton Gallagher METROmilwaukee "Regional Information Services" NET csgallagher AT metromilwaukee. com URL http://clintongallagher.metromilwaukee.com/
"Thubaiti" <Th******@discu ssions.microsof t.com> wrote in message news:78******** *************** ***********@mic rosoft.com... Hi,
I have this code in my ASP.NET and I want to convert it to C# (code behind) <asp:Repeater id="subCategory Repeater" runat="server"> <ItemTemplate > <ul> <li> <asp:HyperLin k id="subCategory HyperLink" runat="server"
NavigateUrl='<% # "subcategory.as px?subcategoryi d=" + Convert.ToStrin g(DataBinder.Ev al(Container.Da taItem, "id")) %>'> <%# Convert.ToStrin g(DataBinder.Ev al(Container.Da taItem, "name")) %> </asp:HyperLink> </li> </ul> </ItemTemplate> </asp:Repeater>
And this is my code behind:
private void subCategoryName (SqlString categoryId) { subcat.Category Id = categoryId.ToSq lDecimal(); DataTable dataTable = subcat.SelectAl lWcategoryIdLog ic();
subCategoryRepe ater.DataSource = dataTable; subCategoryRepe ater.DataBind() ; }
Any help ?
thanks
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Chung |
last post by:
Hi All,
Can anyone tell me how can I call a client script
(javascript) from Code behind server code (c#)?
Chung
|
by: Johann Blake |
last post by:
My ASP.NET application is written using C# script as well as C#
code-behind.
After setting a breakpoint in the script and running the application,
I click from one page to the next but when I get to the page where the
breakpoint is, the code doesn't break in the IDE at the breakpoint.
The breakpoint is in a Page_Load section. All pages in my app are in
the same directory and use relative linking to move from one page to
the next. No...
|
by: Bob T |
last post by:
Hi All,
I am trying to pass a variable from my VB asp.net script (from for example
Sub Page_Load in mypage.aspx.vb) to my Client side script.
I have found and looked at a very good example "Client and Server Scripting
in Web Pages" but it only shows server side scripting that is written in
HTML in mypage.aspx and not script from mypage.aspx.vb. How can I pass a
variable value from mypage.aspx.vp to my client side script?
|
by: Brett Robichaud |
last post by:
I understand how code-behind can handle events for a page, but can I call a
code-behind method from within a <script> tag in my ASP.Net page, or can I
only call methods defined in other <script> sections? I can't seem to
figure out the syntax for for calling code-behind directly. The method is
within the class my page inherits from and is public, but when I try to call
it from my page I get this error:
CS1520: Class, struct, or...
|
by: Russ |
last post by:
I've been trying to get my head around this for 3 days now and it
seems like everything I try does not work for one reason or another.
I built a test page using the TabStrip and MultiPage controls. The
example shows how to put up pictures in each tab, and it works fine.
But of course I don't want pictures, I want a webform where the data
is different in each tab/view. The form could be different in each
tab too, but for now I'll settle...
| |
by: Dustin II. |
last post by:
Hi, I have an ASP.NET solution, and the ASPX page I have a form , I want to
copy some of the data from that form to the clipboard, I am using the below
script the script works fine when I use a normal anchor tag with the onclick
event, but I want to be able to use an actual asp control like the hylperlink
or linkbutton. I have tried the link button but it gives an error saying
Compiler Error Message: BC30456: 'VBScript' is not a member of...
|
by: Alan Silver |
last post by:
Hello,
I have installed the 2.0 framework, and am looking at converting some of
my 1.1 pages to use partial classes. I don't (yet) have VS2005, so I'm
doing this by hand, but am having problems.
I have a simple page that I made in the beta2 version of VWD. The code
behind looks like...
using System;
|
by: oliver |
last post by:
QUESTION: How to access an object embedded in a UserControl through
Javascript file?
Another way to ask this question: How to execute script from a UserControl,
accessing other objects in that UserControl? (Script attached to, and
executed by, a UserControl embedded server control can ‘see’ the UserControl
through the root document architecture. How to get the script to execute and
‘see’ other server controls in the...
|
by: Gary |
last post by:
Hello,
Anyone know how to do the following in c# - using inline codeblocks?
<% If Request.Form("Name") = "Gary" Then %>
<asp:RequiredFieldValidator ID="GarysValidation" ErrorMessage="Gary, you
have chosen the wrong option<BR>" ControlToValidate="Name" Display="Dynamic"
runat="server"></asp:RequiredFieldValidator>
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |