|
I am binding dropdown with database using datasource.
I don't have any --Select-- option in the database.
Now i wan't to bind the --select-- option as the first element of dropdown so that the Index of --select- option is 0
This all the Bind was doing dynamically
Kindly help me
Madhu
|
|
|
|
|
After you have bound the datasource to the dropdown insert an item to it
ddl.Items.Insert(0, "--Select--");
only two letters away from being an asset
|
|
|
|
|
Hi,
you can use following query instead
SELECT 0, '--Select--'
FROM Products
union
select productid,productname from products
just replace ur table names.
hope this works.
Nitin...
|
|
|
|
|
Hi all,
I am using Repeater Control in asp.net 2.0. In this, i ve dynamically created the Repeater Templates ( Header, Item, Footer, etc..) , following the MSDN URL and it works fine.
http://msdn2.microsoft.com/en-us/library/0e39s2ck.aspx[^]
My Objective:
I wish to Construct each Template in different Class, NOT in the same class (Codebehind class) where i ve used my Repeater control in the Page (.aspx file).
In this , how can i implement the Item_DataBinding event handler ?
I need the logic in which it can be implemented ? Pls. Help me ?
-- modified at 9:46 Friday 25th August, 2006
Regards,
Jay
|
|
|
|
|
Hi, if I understand correctly.
You want to use a function from a different class, to implement Item_databinding.
You can maybe have a look at the Objectdatasource. The ODS can be used as a way to call a method from another class... here is a simple example (I used a gridview in this example).
<asp:ObjectDataSource id="odsInvoice" TypeName="Mynamespace.Business.Invoices"<br />
SelectMethod="GetDetails" runat="server"><br />
</asp:ObjectDataSource><br />
<br />
<asp:gridview id="gvInvoices" runat="server" datasourceid="odsInvoice" <br />
autogeneratecolumns="true" Width="980" AllowSorting="False" />
Here I use a ODS to fill my gridview from another class that contains the method.
|
|
|
|
|
Thanks for your reply. But this is not, what i am expecting. I think, my question is not clear.
I wish to create the Repeater Control's Templates Dynamically using C# Class.
For that, u am using a class,
public class MyTemplates : System.Web.UI.ITemplate
{
public MyTemplates(template_type){ }
//Other code here.
}
This Class is Present in the Code Behind (.cs) of the Web (.aspx) Page.
Also this Template Class (mentioned above) is Present Inside of a Class which Inherits Page Class. I ve given the outline below.
public partial class ExampleClass: System.Web.UI.Page
{
Page_Load(object sender, EventArgs e) { }
static void Item_DataBinding(object sender, System.EventArgs e) { }
public class MyTemplates : System.Web.UI.ITemplate { }
}
This "Item_DataBinding" event handler is used by MyTemplates Class, Ok. But, this event handler is belongs to Page Class.
In this, if i take out the "MyTemplates" class and Put it as a seperate class, how can i make use of the "Item_DataBinding" event handler?. This is my doubt?
My AIM is to Create Dynamic Templates outside ( C# Class), and use that Template in my Web Page Code Behind class , and bind the values of the Controls in the Page using "Item_DataBinding" event handlder.
Any Suggestions ?
Regards,
Jay
|
|
|
|
|
In the C file I have this function
DllExport int FunctionName(char *oStrP, const char *iStrP){<br />
}<br />
I did this to import it:
[DllImport(@"path\Mydll.dll", EntryPoint="FunctionName", SetLastError=true, CharSet=CharSet.Auto, ExactSpelling=true, CallingConvention=CallingConvention.StdCall)]<br />
unsafe public static extern int FunctionName(ref char * oStrP, ref char [] iStrP);
but I'm getting errors when actually calling the function.
I've tried string, char[], char*, but it always fails.
What should be the correct syntax for this?
tnx !!
I've found a living worth working for, but I haven't found work worth living for.
<marquee>
|
|
|
|
|
|
|
Can anybody please tell me how to send an xml file to a remote webmethod as an input? we dont have any access to the webmethod code and dont know the implimentation part. We just need to send our input file in xml format or the xml text itself to the webmethod and the webmethod is going to return an output xml string to us. I need to do this using aspx page and c#.net language. I tried sending the xml text with httpRequest and Response, but I got forbidden error from the server. my problem is just how to send a text in the form of parameter to any webmethod?
thanks in advance,
regards,
anil
|
|
|
|
|
|
thanks for the link...will go through it.
|
|
|
|
|
Because the server response says something about forbidden , so IMO you first need to make sure that the web service is accessible to your client side code, then have a look at the contract of the service to make a call properly.
|
|
|
|
|
thanks for the suggesion. i finally found out that there was one tag which was not being accepted by the webservice. there was no syntactical problem with the tag. but after removing that tag, the request went successfully! this is strange. but i am trying to find the real casue.
any way.. thanks for your help.
-- modified at 2:45 Monday 28th August, 2006
|
|
|
|
|
I created the asp.net project.
It contains with java script, htm and aspx.
java script for the menu, when user click the link load the relevent pages.
htm page load without problem, but aspx pages not load, giving the following runtime error.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customerrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customerrors> tag should then have its "mode" attribute set to "Off".
<configuration>
<system.web>
<customerrors mode="Off">
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customerrors> configuration tag to point to a custom error page URL.
<configuration>
<system.web>
<customerrors mode="RemoteOnly" defaultredirect="mycustompage.htm">
please help me to fix that error and tell me whats the reason?
i already set the customErrors mode to the off
i need your help immeadatly
thanx
Software Devolper in future.
|
|
|
|
|
Your code snipets are not displayed. Check the checkbox "Ignore HTML tags in this message (good for code snippets)" to your post. We cannot see the code.
regards,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
I created the asp.net project.
It contains with java script, htm and aspx.
java script for the menu, when user click the link load the relevent pages.
htm page load without problem, but aspx pages not load, giving the following runtime error.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
please help me to fix that error and tell me whats the reason?
i already set the customErrors mode to the off
i need your help immeadatly
thanx
Software Devolper in future.
Software Devolper in future.
|
|
|
|
|
Try opening the same page on the server with server name as localhost. It will show the error details on the screen. You should be able to digout using those details.
- ashish
|
|
|
|
|
Hi,
I am using inbuild datagrid paging.
I don't want to display pagenumber(i.e 1 2 3.....) if there is only single page in datagrid.
Anybody knows how to do this.
thanks.
Nagraj
|
|
|
|
|
if datagrid1.pageSize<10 then '10 is your pagesize
datagrid1.allowPaging=false
else
datagrid1.allowPaging=true
end if
With regards,
Suresh Dayma
-- modified at 6:40 Friday 25th August, 2006
|
|
|
|
|
Yes,I want to display pagenumbers.But i don't want pagenumber when there is single page in grid.
I mean if pagesize =5 and only 4 records are there in grid,then pagenumber shows 1.This 1 I don't want on single page
I hope now i am clear.
|
|
|
|
|
Hey,
To give you my back ground, I come from a strong C++ background and have been using asp.net (c#) for a couple of months now and am not bad. I can create registration sites, secure logins, connecting to databases etc..
Now I just had a friend who needs someone to code the backend for a e-commerce site, the interface will be built by the other person but they need me to handle the backend coding, so basically what i would like advice on, is should I take the job?
I am not actually sure how big of a job this is. I know that the customer needs to be able to pay for the items by credit card. I am pretty sure I will need a secure site, and use of a ssl certificate, and the use of a merchant account from a bank? but again I dont (at the moment) have much experience.
If anyone could give me advice on whether A. I would be able to complete the job, B. How long should it should take, anc C. any good articles that could get me on my way I would be much appreciative.
Thanks for your time.
|
|
|
|
|
|
Hey,
To give you my back ground, I come from a strong C++ background and have been using asp.net (c#) for a couple of months now and am not bad. I can create registration sites, secure logins, connecting to databases etc..
Now I just had a friend who needs someone to code the backend for a e-commerce site, the interface will be built by the other person but they need me to handle the backend coding, so basically what i would like advice on, is should I take the job?
I am not actually sure how big of a job this is. I know that the customer needs to be able to pay for the items by credit card. I am pretty sure I will need a secure site, and use of a ssl certificate, and the use of a merchant account from a bank? but again I dont (at the moment) have much experience.
If anyone could give me advice on whether A. I would be able to complete the job, B. How long should it should take, anc C. any good articles that could get me on my way I would be much appreciative.
Thanks for your time.
|
|
|
|
|
Hi,
I am trying to create a TreeView programmatically, but cannot get my EventHandler to work - unless I do like below - is that really the way to do it?
I want to add a TreeView and when the user posts back some data, I want that data in the TreeView. My first thought was to put in if (!IsPostBack) before the CreateTreeView() call and then add the data in the EventHandler and then calling the CreateTreeView() at the very end. This, however, does not add the EventHandler
Do you really have to create the control twice? Once with the pre postback data and then one after adding the postback data to the control. The example below is very simple, but in my real app it will cause a lot of trouble as there are many controls with EventHandlers being added.
Can you execute any code after the events have fired?
I have been looking high and low for an answer, but have found none, so I hope some one can help
If you need more info, please let me know.
Kind regards,
Lars
public partial class _Default : System.Web.UI.Page
{
StringCollection nodes = new StringCollection();
TreeView TreeView1 = new TreeView();
protected void Page_Load(object sender, EventArgs e)
{
TreeView1.SelectedNodeChanged += new EventHandler(NodeChanged);
nodes.Add("Node1");
//if (!IsPostBack)
CreateTreeView();
}
protected void NodeChanged(object sender, EventArgs e)
{
// This could be data added by the user
nodes.Add("Node2");
CreateTreeView();
}
void CreateTreeView()
{
TreeView1.Nodes.Clear();
foreach (string s in nodes)
{
TreeNode node = new TreeNode(s);
TreeView1.Nodes.Add(node);
}
this.form1.Controls.Add(TreeView1);
}
}
|
|
|
|
|