473,399 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Gridview and User Control

Hi,

I use a user control within a gridview
Something like this

<asp:GridView DataSourceID="myDatasource" ID="gvList" runat="server">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Literal runat="server" id="article" Text='<%#
Eval("myArticle")%>' />
<uc:MyControl runat="server" ID="myUC" Url='<%#
Eval("myUrl")%>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
My UserControl is a control that must control an url to display a picture
(it makes some actions before).
For my test, I just put a literal on the control and add a property

private string _url="";
public string Url
{
get {return _url; }
set {_url=value;}
}

Inside the page Load event (of the user control), I just have
myLiteral.Text=Url;
But when I use <uc:MyControl runat="server" ID="myUC" Url='<%#
Eval("myUrl")%>' />, it seems it doesn't submit the field's value.
If I use <uc:MyControl runat="server" ID="myUC" Url="test" /I get the test
value for each row of my gridview.

How can I solve this problem ??

Thanks for your help

Stan


Jan 21 '07 #1
1 2436
Ooops..
I ve found the solution...
I had to change my setter like this

set {
myLiteral.text=value;
_url=value;
}
It seems it works.

Stan

"Stan SR" <st**@pasdepam.netsunset.coma écrit dans le message de news:
OD*************@TK2MSFTNGP06.phx.gbl...
Hi,

I use a user control within a gridview
Something like this

<asp:GridView DataSourceID="myDatasource" ID="gvList" runat="server">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Literal runat="server" id="article" Text='<%#
Eval("myArticle")%>' />
<uc:MyControl runat="server" ID="myUC" Url='<%#
Eval("myUrl")%>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
My UserControl is a control that must control an url to display a picture
(it makes some actions before).
For my test, I just put a literal on the control and add a property

private string _url="";
public string Url
{
get {return _url; }
set {_url=value;}
}

Inside the page Load event (of the user control), I just have
myLiteral.Text=Url;
But when I use <uc:MyControl runat="server" ID="myUC" Url='<%#
Eval("myUrl")%>' />, it seems it doesn't submit the field's value.
If I use <uc:MyControl runat="server" ID="myUC" Url="test" /I get the
test value for each row of my gridview.

How can I solve this problem ??

Thanks for your help

Stan


Jan 21 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
5
by: Dick | last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls GridView.DataBind. I want the row that is selected before the DataBind to still be selected afterwards. This happens...
1
by: Giovanni | last post by:
Dear Friends/Gurus, I have exhausted myself and have yet no solution to the following: I have an ASP.NET 2.0 Survey type application. On a page, I have placed a GridView which is bound to an...
0
by: bsaran | last post by:
Hi, I have a code that sort of works. The event flow is as follows: In a user control of type "FilterControl" user selects certain values from 3 related dropdown lists. (two of them have auto...
0
by: John Smith | last post by:
ASP.Net 2.0 / C# / IIS 6 I have 2 pages. The master page consists of a tabbed menu created using the Menu and MultiView controls. Something like this: ...
0
by: John Smith | last post by:
If anyone can help, I would very muchly appreciate it. I have a main page that uses the .net 2.0 menu control with the multiview controls as the menu choices. This works fine. One of the menu...
4
by: Jeff | last post by:
Hi, I have a ASP.NET 2.0 Web Application. Many of the pages use the ASP.NET GridView with paging and sorting. One of the columns of this Gridview is a template column (LinkButton). The data being...
2
by: =?Utf-8?B?UGF1bA==?= | last post by:
I have a gridview with 2 columns. One column is a BoundColumn to a part number (string). One column is an ItemTemplate with a FileUpload control. There can be multiple rows (i.e. part numbers)...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.