Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

Andre Vianna

@Andre Vianna
About
Posts
6
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Converting between types inside Lambda Expressions
    A Andre Vianna

    Hi, I need some urgent help on something. I need to convert Expression<Func<T1, bool>> to Expression<Func<T2, bool>>. I have a funtion that does T2 = Convert(T1) In other words I need a function that does something like:

    Expression<Func<T2, bool>> Convert(Expression<Func<T1, bool>> pSource) {
    Expression<Func<T2, bool>> vResult;
    ...
    ...
    ...
    T2 vOutpuParameter = Convert(vInputParameter); // vImputParameter of type T1
    ...
    ...
    ...
    return vResult;
    }

    Does anyone have any clues?

    C# linq functional help question

  • CompositeDataBoundControl designer crashes VS2008
    A Andre Vianna

    I'm building a very simple composite control and when use the designer to select a data source it crashes Visual Studio 2008. Here is the code:

    namespace WebControlDesigner {
    [ToolboxData("<{0}:ControlWithTasks runat=\"server\"></{0}:ControlWithTasks>")]
    public class ControlWithTasks : CompositeDataBoundControl {

    	public ControlWithTasks() : base() { }
    
    	\[Category("Apearance")\]
    	\[DefaultValue("Your Birthday")\]
    	public string Prompt {
    		get { return (string)ViewState\["Prompt"\] ?? "Your Birthday"; }
    		set { ViewState\["Prompt"\] = value; }
    	}
    
    	\[Category("Data")\]
    	\[Bindable(true)\]
    	public DateTime Birthday {
    		get { return (DateTime?)ViewState\["Birthday"\] ?? DateTime.Now; }
    		set { ViewState\["Birthday"\] = value; }
    	}
    
    	protected override int CreateChildControls(IEnumerable pDataSource, bool pBinding) {
    		base.CreateChildControls();
    
    		Label vLabel = new Label();
    		vLabel.Text = Prompt;
    		vLabel.ForeColor = Color.Red;
    		this.Controls.Add(vLabel);
    
    		Literal vLiteral = new Literal();
    		vLiteral.Text = ":&nbsp;";
    		this.Controls.Add(vLiteral);
    
    		TextBox vTextBox = new TextBox();
    		vTextBox.ID = "TextBox1";
    		vTextBox.Text = Birthday.ToString();
    		this.Controls.Add(vTextBox);
    
    		return 0;
    	}
    }
    

    }

    It's an extremely simple control, and builds without error. Here is the page that consumes it:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
    <%@ Register Assembly="WebControlDesigner" Namespace="WebControlDesigner" TagPrefix="wcd" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title></title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <wcd:ControlWithTasks ID="ControlWithTasks1" runat="server">
    </wcd:ControlWithTasks>
    </div>
    </form>
    </body>
    </html>

    It renders perfectly and display the designer menu correctly but if I create a data source or try to select a existing one it crashes VS2008. :omg: :confused: What is missing? Please!! I need some help.

    C# csharp help question html visual-studio

  • How to access internal methods
    A Andre Vianna

    I'm trying to build a custom control and I'd like to access some funcionalities of ClientScriptManager defined as internal on System.Web.UI Here is a sample code:

    namespace MyWebControls {
    public class MyGridView : System.Web.UI.WebControl.GridView {
    ...
    protected internal virtual MyMethod(object pLiteral) {
    ...
    var vLiteralName = ClientScriptManager.GetScriptLiteral(pLiteral);
    ...
    }
    ...
    }
    }

    I've tryied also:

    		var vLiteralName = this.Page.ClientScript.GetScriptLiteral(pLiteral);
    

    The functionality exists but is defined as internal. How can I access it? Maybe some property on the Assembly. Change the namespace. I've tryied several things. Please give me some light. Thanks.

    C# question design tutorial

  • Overloading a return value to a property in a webcontrol. Ambiguous Match Found Error.
    A Andre Vianna

    I'm creating a CustomGridView based (of course) on the GridView. I'm writen my on PagerProperties with a diferent class and diferent properties. Everything works ok with the default values but if I set any value I receive the "Ambiguous Match Found" error. Here is a sample code of what is happening:

    public sealed class MyPagerSettings : IStateManager {

    ...
    [Category("Appearance")]
    [DefaultValue(true)]
    [NotifyParentProperty(true)]
    public bool Visible {
    get { return (bool?)mViewState["Visible"] ?? true; }
    set { mViewState["Visible"] = value; }
    }

    ...
    }

    public class MyGridView : GridView {

    ...

    MyPagerSettings mPagerSettings;
    
    
    \[Category("Paging")\]
    \[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)\]
    \[NotifyParentProperty(true)\]
    \[PersistenceMode(PersistenceMode.InnerProperty)\]
    `new` public virtual MyPagerSettings PagerSettings {
    	get {
    		if (mPagerSettings == null) {
    			mPagerSettings = new MyPagerSettings(this);
    			if (IsTrackingViewState)
    				((IStateManager)mPagerSettings).TrackViewState();
    		}
    		return mPagerSettings;
    	}
    }
    

    ...

    }

    The new modifier should hide the base property. On the consuming page:

    		<awc:MyGridView ID="MyGridView1" runat="server" AllowPaging="True" PageSize="10">
    			`<PagerSettings Visible=false />   <-- The error happens here!`
    			<Columns>
    

    ...
    </Columns>
    </awc:MyGridView>

    Please any help on how to work around it? Please... I don't want to change the name of the property!!! So no obvious answers please. Thanks.

    C# help question sysadmin regex tutorial

  • Secure Web Service with C# DataSource
    A Andre Vianna

    Hi, I have a webservice serving a dataset with several tables. Every table has two main webmethods that allows then to interact with the databound controls in the client. The general form of these methods are (please, its just a sample code to give the idea of the process): [WebMethod] public MyDataSet.MyTableDataTable MyTableGetAll() { MyDataSetTableAdapters.MyTableTableAdapter vTa = new MyDataSetTableAdapters.MyTableTableAdapter(); return vTa.GetAll(); } [WebMethod] public int MyTableUpdate(MyDataSet.MyTableDataTable pDt) { MyDataSetTableAdapters.MyTableTableAdapter vTa = new MyDataSetTableAdapters.MyTableTableAdapter(); return vTa.Update(pDt); } They work just perfect and I can use any databound control as if the dataset was local. But how can I add encryptation to this solution without losing the bahavior of the conection. I know how to send encrypt data via RSA keys thru a webservice but only with basic datatypes (as string or itegers) and even encrypt a content of a XML message. But how can I encrypt the data and the metadata structure (cause it would be terrible to encypt the data and give up the table structure in the resulting XML) and retrieve the DataTable object funcionality at the client side and vice-versa? The following solution works? // Server side [WebMethod] public {XML or String} MyTableGetAll() { MyDataSetTableAdapters.MyTableTableAdapter vTa = new MyDataSetTableAdapters.MyTableTableAdapter(); return **SomeEncryptFunction**(vTa.GetAll()); } // Client side public localhost.MyDataSet.MyTableDataTable GetMyTableData() { localhost.WebService vSvc = new localhost.WebService(); return **SomeDecryptFunction**(vSvc.MyTableGetAll()); } // Some Other place in the Client Side ... oDataBoundObject.DataSource = GetMyTableData(); ... If It does what would be the code for SomeEncryptFunction and SomeDecryptFunction (the second one is the most important 'cause it has to retreive the DataTable object properly) ? Thanks in advance for any help about this. Sir Gallahad P.S. I've been reading about implementint security and cryptograpy to web services with WSE SOAP headers. But the articles I've read does not explain well how to code in the client and server side to make the handshake between them. If that is the solution, can someone help me explaining how to do that. Please any clue. Any code. Any link. Please. :confused:

    C# wcf xml question csharp sysadmin

  • The DataSource Window in VS2005 is not recognizing a DataSet served through a WebService
    A Andre Vianna

    I've developed a webservice serving a data set. This is the code: ----------------------------------------------------------------- using System; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using System.Data; using System.Data.SqlClient; [WebService(Namespace = "http://localhost/WSTest/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class ERPService : System.Web.Services.WebService { public ERPService () { } [WebMethod] public DataSet listaEntidades() { SqlConnection con = new SqlConnection("[hidden for security reasons]"); SqlDataAdapter daEntidade = new SqlDataAdapter("SELECT * FROM Entidade", con); DataSet ds = new DataSet(); con.Open(); daEntidade.Fill(ds, "Entidade"); con.Close(); return ds; } } ----------------------------------------------------------------- It works fine in the browser but when I create a new window project and try to add this service as a data source to bind it to a DataGridView, the interface does not add the DataSource to the window. It reconizes the service ok the reference is added to the project but no data source is displayed. What's wrong? André Pires

    C# security question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups