|
The obvious way is to do it in your data layer
select x, y, x+y as z from myTable
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
if u do not have access to data layer, u can better do it in rowdatabound event.. read value from cells at specific index and add it up to assign it to label present in third column(obviously template column)....
Ashish Sehajpal
|
|
|
|
|
Hi all,
I'h a ajax control ModalPopupExtenderModal in my site, and it's have targetcontrolID to an imagebutton so far so good, and the popUpcontrolID is directed to an panel and thats ok too, but when I click on the imageButton and get the larger image to view, it's ok but I want to click the large image and be redirected back to the page where i came from....
Do somebody have any tips, how I can do that?...
/max
|
|
|
|
|
As I understand it, you want the popup to disappear when the user clicks something in the popup. I think the functionality the cancel button has implemented in this example[^] is what you need. You can download the samples and view the source on how they did it.
Broken Bokken
http://www.brokenbokken.com
|
|
|
|
|
perfect, I solved it...thanx...
/max
|
|
|
|
|
plzz tell me when we write atlas:scriptmanager and when asp:scriptmanager.
tbhattacharjee
|
|
|
|
|
I believe atlas is the old name for it, as in prerelease.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
You are right. If you have old code, chances are that your library has a mapping in the web.config for the library to the prefix atlas.
It might look something like this
<pages>
<controls>
<add tagprefix="atlas" namespace="System.Web.UI" assembly="System.Web.Extensions" />
</controls>
</pages>
You may want to double check that you have the latest version of the ajax and the control toolkit downloaded.
Broken Bokken
http://www.brokenbokken.com
|
|
|
|
|
thanks for your answer .
tbhattacharjee
|
|
|
|
|
Hi,
I am displaying image in the datalist. But if image is blank then in IE it will display blank image but in FireFox it is displaying Submit Query.
How Can I remove Submit Query. I am using image button.
Any other Solution for that.
Thanks
|
|
|
|
|
have you mentioned alternateText there?
a better approach is to use a blank image as default image i.e. an image with some text like "No Image" written in it to be used in cse user has not uploaded any image...
Ashish Sehajpal
modified on Tuesday, April 15, 2008 10:17 AM
|
|
|
|
|
I have a problem how I get the user controls parameter from codebehind (when I make a dynamic instans of this) on the page.
My user control ascx file:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TestSetProject.ascx.cs" Inherits="UserControls_TestSetProject" %>
<center><h3><asp:Label ID="lblEditProjectHeadline" runat="server" Text="Projektdetaljer for"></asp:Label>
<asp:Label ID="lblEditProjectNameHeadline" runat="server" Text=""></asp:Label></h3></center><br />
My user control ascx.cs file:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class UserControls_TestSetProject : System.Web.UI.UserControl
{
private string _ProjectId = "";
public string ProjectId
{
get { return _ProjectId; }
set { _ProjectId = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
lblEditProjectNameHeadline.Text = ProjectId;
}
}
My test aspx page:
<%@ Page Language="C#" MasterPageFile="~/MPHead.master" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Content_Test" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:Label ID="lblNewProjectEditProjectId" runat="server" Text="" Visible="false"></asp:Label><br /><br />
<asp:Button ID="btnPush" runat="server" Text="Push me" OnClick="btnPush_Click" />
<asp:PlaceHolder ID="phNewProjectEdit" runat="server"></asp:PlaceHolder>
</asp:Content>
My test aspx.cs file:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Content_Test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Control setproject = LoadControl("~/UserControls/TestSetProject.ascx");
phNewProjectEdit.Controls.Add(setproject);
}
protected void btnPush_Click(object sender, EventArgs e)
{
lblNewProjectEditProjectId.Text = "15855";
}
}
What I need, is that the user control will be instansiated (created) when I click on the btnpush button on the page og then takes what I have wrote in the lblNewProjectEditProjectId.Text into the user control (where I then can use it).
Can anybody please help me on this?
Kind regards,
simsen
|
|
|
|
|
simsen wrote: private string _ProjectId = ""; public string ProjectId { get { return _ProjectId; } set { _ProjectId = value; } } protected void Page_Load(object sender, EventArgs e) { lblEditProjectNameHeadline.Text = ProjectId; }
Replace all of this with:
public string ProjectId
{
get { return _lblNewProjectEditProjectId.Text; }
set { _lblNewProjectEditProjectId.Text = value; }
}
your issue right now is that page load occurs before any events, and you will have trouble setting the property so it gets used. Even if you move it to prerender, just setting it directly seems more sensible to me.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi Christian,
Thanks for your reply,
I tried to use your code indstead.....But I then get a problem when running the code... It sais that the _lblNewProjectEditProjectId doesn't exist.
What do I miss?
The _lblNewProjectEditProjectId is on the aspx page and not on the ascx page where I have to use it. And I have to use the ProjectId (I get from the aspx) on the ascx page. I don't know the labels id each time I have to use the control (the control will be used on different pages).
Kind regards,
simsen
|
|
|
|
|
simsen wrote: The _lblNewProjectEditProjectId is on the aspx page and not on the ascx page where I have to use it
OK, then I dunno how it ever compiled. What does the user control do, if the property you want to set is on the aspx ? Why does the user control matter then ?
If you want to set a property on the control and have it change a control on the main page, that seems strange to me, but you could use a delegate to pass the value through. It's sloppy tho, if the control is on the aspx. set it there.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I have an aspx page where I do many things - I create projects which are listet in a gridview. When I click on a button in the gridview, I want to load a user control with the projectId I selected on the pages gridview.
The user control is a page, where I load the parameters from the database and then can edit these. To load the parameters from the database in the user control, I need the projectId, wich only exists on the aspx page. I will now parse the projectId
If I do it "the old way" I could do this by:
<crm:SetProject runat="server" id="SetProject" ProjectId="500" />
and the projectId"500" is passed to the user control........But my problem here is I don't know what the projectId before I hit the button.....
|
|
|
|
|
what are u talking about? its not clear...
USER Controls are used to make abstraction in a complex logic. the dot net architecture suggests that if one needs to pass some value to UC (user control) and then there is something to be processed in UC and after some event the user needs some value to be read form the UC......the only way is :->
create user control UC
->
declare a public property named INPUTVAL for getting input
->
declare another proerty named OUTPUTVAl for producing some output/operation of filling dropdownlist
->
define a method for processing something named as BINDUC()
->
use the UC on an .aspx page
->
pass the projectID as ....... UC1.INPUTVAL= dropdownlist1.selectedValue // may be from anything else
->
now the processing in the UC will take place...RIGHT in ur case...... so call the method
->
UC1.BINDUC()
->
Read the value from UC in the variable on .aspx page
->
projectIDUC=UC1.OUTPUTVAl
its over !
hope it will help...
Ashish Sehajpal
|
|
|
|
|
Your core issue as far as I can see, is that you are setting your property in page load, which is too early. Trying to do it in the prerender event may solve your issue, but I still don't get why a user control is needed to change a setting on the aspx
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'm sorry I don't explain myself so good (my english is not SO good)...
For me it is simple - I have a usercontrol.....
Normally i would do this.......
<crm:SetProject runat="server" id="SetProject" ProjectId="500" />
on an aspx page to load the usercontrol with the parameter ProjectId = 500 - I then in the user control can use the 500 to do something with this.....
My problem is - when I do it this way - the parameter will always be 500 - And I don't know what the parameter is at page load time....... I first know what the parameter is when I hit a button on the page........
So when I hit the button - I need to make an instans of the usercontrol with the parameter ProjectId="9999"
|
|
|
|
|
simsen wrote: So when I hit the button - I need to make an instans of the usercontrol with the parameter ProjectId="9999"
So, you set it in code when you create the control. ProjectId must be a public property, or it would not be available from the aspx. Why can't you just set it in code ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Now we are getting to my problem........
I don't know how to set it when I create the control..... I tried many things but each time it sais - it dosn't know the SetProject.ProjectId....
I use these to lines to create the control from codebehind....
Control setproject = (Control)LoadControl("~/UserControls/TestSetProject.ascx");
phNewProjectEdit.Controls.Add(setproject);
But when I then try to make a
setproject.ProjectId
the system cannot find the ProjectId - the error sais something like this:
System.Web.UI.Control doesn't contain a definition of 'ProjectId'
|
|
|
|
|
simsen wrote: Control setproject = (Control)LoadControl("~/UserControls/TestSetProject.ascx"); phNewProjectEdit.Controls.Add(setproject);
There is your problem. The Control class does not contain this property. You need to cast to the type of your specific control, to be able to access the properties that exist in your control and not the base class.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I don't understand that you say that the control doesn't contain this property.....
If you see the ascx.cs you can se I have made a public property?
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class UserControls_TestSetProject : System.Web.UI.UserControl
{
private string _ProjectId = "";
public string ProjectId
{
get { return _ProjectId; }
set { _ProjectId = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
lblEditProjectNameHeadline.Text = ProjectId;
}
}
|
|
|
|
|
You should buy a book on OO and read it then.
You are creating an instance of your control, but your local reference, is a reference to a base class. It therefore does not know that the class instance is a specific derived class, it could be any class derived from Control. Until you cast it up to the class thhat contains that property, it will not be visible.
If you do this:
((UserControls_TestSetProject )myControl).ProjectId = "Blah";
it will work, assuming your variable is called myControl. For the reasons I have explained.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thank you very very much...... It was what I needed...... Now I only have to figure out, how I get it without to have to push the button twice (I know it's becauce of the page_load comes before the btnPush_Click and I have to make an instans of the user control each time I load the page)
I wil use some times of this problem before I get back to this forum for help....
But again thank you very much for your help. It helped me very much
|
|
|
|