Do you update the service reference at the client side?
minhpc_bk
Posts
-
My web service doesn't seem to update when I compile it -
Who's the expert in ASP.NETKusal wrote:
Who's the expert in ASP.NET
Kusal wrote:
My project has this files - Web.config, Global.asax What are the important in here. I need get complete idea about content in this file. Any one can pls give clear idea or submit articles or links. And also give idea about Forms Authentication / Windows Authentication ?
-
Can't retrieve data out of a GridView ControlActually, you can set the DataKeyNames property either in the control definition or in code, the values should be taken from the result data reader. For example:
GridView1.DataKeyNames = new string[] { "Id" };
....
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
object key = GridView1.DataKeys[e.NewEditIndex].Value;
} -
Setting property via ReflectionIn this case, you should use the the type converter of the property to convert a string value, this way will work not just with the primitive types, but also with custom types. To get the TypeConverter[^], you can use the TypeDescriptor[^], your sample code is updated a bit like this:
public void SetProperty(Control control, string propertyname, string propertyvalue)
{
Type type = control.GetType();
System.Reflection.PropertyInfo pi = type.GetProperty(propertyname);TypeConverter converter = TypeDescriptor.GetConverter(pi.PropertyType); object value = converter.ConvertFromInvariantString(propertyvalue); //object value = Convert.ChangeType(propertyvalue, pi.PropertyType); pi.SetValue(control, value, null);
}
-
Setting property via ReflectionYou might want to see the ParseControl[^] method.
-
Setting property via Reflectionszukuro wrote:
Anyone else know a better solution?
As long as I I don't know what your context is, for example why you need reflection here, then IMO it's hard to say this is a good/bad choice or whether there is a better one.
-
Dynamically Updating web.config -
2.0 UserCtrol and StylesIf you want to make it work with the designer, you'll have to use a custom control (CompositeControl) instead as the design-time support for the usercontrol is limited in VS, it always looks at the base class
UserControl
to parse any nested elements you define in your user control. -
Can't retrieve data out of a GridView ControlQuecumber256 wrote:
The problem I’m having is I don’t know how to read the data stored in the first column on the GridView Control.
+ You can get reference to the first cell of a row to get the value. + Another option is to store the key values using the DataKeyNames[^] property and you can access the value from the
DataKeys
collection. -
Editing server-side Excel s/sheet in ASP.Net 2.0 Page - how?IMHO, you might want to check out a couple of things: + Use Webdav to manage/edit the files. + Show the file contents at the client side in the Excel-like display, here you can might want to look for some custom grid controls supporting Excel-like style, then the client can edit in the web page and finally submit the changes to the server. + You can allow the user to open the Excel file on their box with the Excel application, then you can use an Excel add-in to capture the Save action to send the edited file to the server.
-
Problem with CompareValidator to compare TextBox control with Label controlThat's because the Label control is not marked with the ValidationProperty[^]. So you either a) customize the label control or b) use a invisible textbox to contain the value beside the Label so that you can validate the textbox.
-
custom section in configuration filesred60mans wrote:
1)PublicKeyToken --- Is this the one generated thru sn.exe???
You can see the PublicKeyToken value when your assembly is made strong-named, otherwise it's a null value.
red60mans wrote:
2)System.Configuration.AppSettingsSection --- Is this any name or should it be my class name
It should be your fully qualified name of your class as you here want to create a custom config entry.
red60mans wrote:
- System.Configuration --- what about this ???
This is the namespace containing your custom config handler class. Basically, when you define a custom configuration section, you'll have to specify the handler for this section and you also need to tell the system about how to locate the type of your class. For more information, see ASP.NET Configuration [^]
-
HTTPHandler Not working on IIS [modified]How do you define your custom handler? How do you configure that handler?
-
system.web.extensions and web.config [modified] -
How should I pass a variable to a "controlid" on a ControlParameter.Basically, the
ControlParameter
does not support theDataBinding
event so you cannot use a data binding expression to set theControlID
property of the parameter, and your choice is to do this in code. Also, you need to be aware that theControlID
property needs to be updated before it is used to populate the value, if it happens after then you'll get an error as the specified control is not found. Normally, the ControlParameter uses its ControlID property to evaluate the parameter value in the overridableEvaluate
method which occurs in theLoadComplete
event of the Page instance. So you can put your code to update the ControlID in the events (of the data source control or the Page instance) that happens before the Page_LoadComplete and of cource after the data source control is built. For example, you can use theLoad
event of the data source control:protected void SqlDataSource1_Load(object sender, EventArgs e)
{
//Assuming the ControlPatameter is the first one in the UpdateParameter collection.
ControlParameter para = SqlDataSource1.UpdateParameters[0] as ControlParameter;
para.ControlID = "GridView1$ctl0" + (GridView1.EditIndex + 2) + "$DropDownList1";
}where the
EditIndex
property of the GridView control will give you the index of the row being edited, this is a zero-based value, however the index used in the UniqueID of the dropdownlist is a one-based value and it is counted from the header row. Therefore, you have to add2
to the EditIndex to get the correct number used in the UniqueID. -
How do i pass the SelectedValue/Index of a DropDownList in a GridViews EditItem Template to a Control Parameter? -
Atlas update panel and Web PartsHi Mark, From what I know the WebPart is still under development, it means that it's in the future features of the ASP.NET AJAX and this error (as well as other errors with the web part/ajax) is still remained in the January CTP.
-
How do i pass the SelectedValue/Index of a DropDownList in a GridViews EditItem Template to a Control Parameter?Because you want to get the value from the dropdownlist then the ControlID should point to this control, not the GridView. However, the dropdownlist is contained inside the GridView, therefore the value of the ControlID will be the uniqueID of the dropdownlist including the id of the containers. So it should be something like
gvOutgoing$ctl02$ddlRecorded
(or you can replace the$
with the:
). There's one more important thing is that the uniqueId of the dropdownlist varies from row to row, so you'll have to update the ControlID dynamically according to which row is being edited. -
ASP.net/SQL newbie QuestionPlanker wrote:
command.BeginExecuteNonQuery(); connection.Close();
You make an asynchronous call to insert data, but you close the connection right after that then how data can be inserted into DB. You might also double check the parameter name
gmaePlatform
as well. -
play video file which is binary form in databaseI don't have any sample code right here in my hand, but you might want to search on the net or write your own as it's simple enough. Basically, you normally use the media file ending with .mp3, .wav ...., to feed the media player, but now you specify a web page, say download.aspx instead (perhaps along with the id of the media file in the query string). Then in the download.aspx file, you just write some code to query the selected media file contents from DB based on the id passed in the query string. You finally write out the binary data to the Response object and that's it.