|
Hi,
Yes. This will give you the selected or entered values of the controls on the form. I wont give you the other option or items.
I think there is no way to achieve what you want to because as soon as a request goes to the server the previous page gets destroyed and each time a new fresh page comes to the browser that to in HTML format.
You could achieve this in windows application but I think its not possible in web application.
Can you tell me your exact requirement so that I can suggest u alternative.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Hi there,
I am using .NET 2.0 with C#.
I have a master page that I use across a couple of pages. Every web pages that uses this master page will have a different title, and maybe different meta key words and meta descriptions, etc.
I found a way of changing this, but I am not sure if this is the best way to do it??
In the code behind of my master page, I have various properties to set the page header, meta key words, meta description, meta identifier URL, meta robots, meta content language, and meta distribution. I have only included the properties of the page header and meta keys words, the rest works on the same principle:
// Properties (partial)
public HtmlHead PageHeader
{
get { return (HtmlHead)Page.Header; }
}
public string MetaKeywords
{
set
{
HtmlMeta keywords = new HtmlMeta();
keywords.Name = "keywords";
keywords.Content = value;
PageHeader.Controls.AddAt(2, keywords);
}
}
Lets say I have a default.aspx that uses this master page, then I would declare <%@ MasterType VirtualPath="~/App_MasterPages/AppMaster.master" %> at the top of the .aspx file. And then in the default.aspx.cx code behind file I would have the following partial piece of code in a method that sets the title and meta key words (called from Page_Load):
// Add the page title to the header element
Page.Title = "MyWebsite | Welcome";
// Add meta elements to the header element
Master.MetaKeywords = "keyword 1, keyword 2, keyword3";
Is there another way of doing this??
Please can someone advise me?
Regards
ma se
|
|
|
|
|
respected gurus
i have created a HTML table at runtime and i m adding label web controls to the column of the table.i just want to set the width of this label at runtime.
also how it can be set to autosize depending upon the text of the label.
thanks
ajay
|
|
|
|
|
Your lable should looc something like this
asp:label id="lblMyLabel" runat="server">Some text<br />
/asp:label>
Be shore to have the id and runat attribute on the lable.
This will bring a
protected System.Web.UI.WebControls.Label lblMyLabel;
in the code behind file for this page(if not, add it).
Now you can set the lables width by
lblMyLabel.Width = Unit.Parse("50%");<br />
or<br />
lblMyLabel.Width = Unit.Parse("64px");<br />
or<br />
lblMyLabel.Width = 54;<br />
If you don't sett the with of the label it will autosize it to the length of the
text, thus the tablecell of the table the lable is in, will of course have a mather to say on the length of the lable.
Hope it helps
Thomas
-- modified at 4:49 Tuesday 17th April, 2007
|
|
|
|
|
Hi,
I'm new in ASP.NET and I need some help urgently. I have a grid view onject and I have build a template object in one of the column, a dropdownlist. This drop down list will have 3 static list item : Deliver, Fulfill, Cancel which will always be shown on the grid view is visible.
Then I have pull out customer data from database and do some formating and each customer data will then be store in a arraylist. I will bind the arraylist to the gridview.
My problem is now, each customer data will have a status say customer X.status = Pending. I want to add this customer customer status to the dropdownlist in addition of the 3 static status and make the current status as selected item, How can I do that?
Regards,
Jia
|
|
|
|
|
I guess you got to write your code in the gridview itemdatabound event.
In the event first check the status of the customer, iam assuming you have a coulmn which has the customer status.
Later find the dropdown control in your datagrid and add your value accordingly
code might be like this:
private gridview1_itemdatabound(object sender, system.......datagrideventargs e)
{
dropdownlist ddl = (dropdownlist)e.item.findcontrol("id of ddl in ur temp column)
for(int i=0;i<gridview.items.count;i++)
{
="" ddl.insert(insert="" your="" values="" to="" be="" added="" dropdown)
.....................
.................
.............
=""
<div="" class="ForumSig">Gautham
|
|
|
|
|
First of all, the DropDownList should contain all the statuses that
is possible for a customer, så Pending should also be a Static value.
Second, it seems to me that inn your Customer database table you have a string
item that contains the status, this is not a good way of designing a database.
You should change it to an integer, where
Deliver = 1
Fulfill = 2
Cancel = 3
Pending = 4
... and so one.
This is because an integer takes less space and it is easyer to search with, and sort by.
Now youre template should look something like this:
<br />
asp:TemplateColumn HeaderText="Status"><br />
ItemTemplate><br />
asp:dropdownlist id="ddlStatus" runat="server" SelectedIndex="<%#ddlStatus.Items.IndexOf(ddlStatus.Items.FindByValue((DataBinder.Eval(Container, "DataItem.intStatus")).ToString()))%>"><br />
asp:ListItem Value="1">Deliver</asp:ListItem><br />
asp:ListItem Value="2">Fulfill</asp:ListItem><br />
asp:ListItem Value="3">Cancel</asp:ListItem><br />
asp:ListItem Value="4">Pending</asp:ListItem><br />
/asp:dropdownlist><br />
/ItemTemplate><br />
intStatus is the integer coulmn name in your database customer table.
Now when you databind your DataGrid the dropdownlist will get the selected item of
the status that the customer has.
|
|
|
|
|
Hi,
I am having some problem removing a child node from the list.
The scenario is when a user login, the tree view should have options base on the user's status.
Example:
Root
-Child1
-Child2
Root2
-Child3
So when some criteria is not met, I wanted Child2 to be remove or hide, but what I found on the net is removing Root and everything in it, so I need to know how to remove this Child1 using code.
Thanks.
J Liang
|
|
|
|
|
Hi Mr. J.
I am using follwoing code for this purpsoe
if (Session["User_Role"].ToString() != "Administrator" )
{
this.TreeView1.Nodes[0].ChildNodes.RemoveAt(0);
}
Tip.
Bind Treeview on load event using code not in design time.
|
|
|
|
|
Hi Naveed,
Thanks for the help. It was my own mistake that I place the this.TreeView1.Nodes[0].ChildNodes.RemoveAt(0); in a wrong if statement that's why nothing happens
J Liang
|
|
|
|
|
Hi All,
I am working on a financial website.
I have to use real time stock quotes ticker(in Marquee format) for that.The stock exchange for which i want to extract the stock details is NSE(India) and the url for the same is http://www.nse-india.com
I searched internet thoroughly but could not meet any code of my requirement.
I am using ASP.Net 1.1 with C#.
Please help me with your precious suggestions and guidelines.
Thanks and Regards,
Vivek Rathore
|
|
|
|
|
Would it not be more efficient to look and see if there is someone providing a webservice feed of these values?
|
|
|
|
|
Invalid Site Name: xxxx
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.CommerceServer.Runtime.CommerceException: Invalid Site Name: xxxx
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
CommerceException: Invalid Site Name: xxxx ]
Microsoft.CommerceServer.Interop.Configuration.SiteConfigReadOnlyFreeThreaded.Initialize(String bstrSiteName) +4114
Microsoft.CommerceServer.Runtime.Configuration.CommerceResourceCollection..ctor(String siteName) +217
Microsoft.CommerceServer.Runtime.CommerceApplicationModule.InitializeApplication() +193
Microsoft.CommerceServer.Runtime.CommerceApplicationModule.Init(HttpApplication appInstance) +76
System.Web.HttpApplication.InitModules() +100
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +1295
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +392
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +256
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +414
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
I am using Microsoft CommerceServer 2002
Mohan balal
|
|
|
|
|
hi,
you go through google, may be you find it. other wise meet prasad may be he knows.
|
|
|
|
|
Hi all ,
I need a function that imports data from excell 2007 to sql 2005 using ASP.net 2.0
Thanks in advance
|
|
|
|
|
private DataSet GetExcelData(string fileName)
{
try
{
string sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileName + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=0;\"";
OleDbConnection conn = new OleDbConnection(sConnectionString);
conn.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = conn;
command.CommandType = CommandType.Text;
command.CommandText = "SELECT * FROM [Sheet1$]";
OleDbDataAdapter da = new OleDbDataAdapter(command);
DataSet ds = new DataSet();
da.Fill(ds, "Final");
conn.Close();
return ds;
}
catch (Exception ex)
{
lblError.Text = ex.Message;
return null;
}
}
protected void Upload_Excel(object sender, EventArgs e)
{
if (UPExcel.PostedFile != null)
{
try
{
string fileName = UPExcel.PostedFile.FileName.Substring(UPExcel.PostedFile.FileName.LastIndexOf(@"\") + 1);
fileName = Server.MapPath(".") + @"\UploadedFiles\" + fileName;
UPExcel.PostedFile.SaveAs(fileName);
DataSet ds = GetExcelData(fileName);
if (ds.Tables["Final"] != null && ds.Tables["Final"].Rows.Count > 0)
{
foreach (DataRow dr in ds.Tables["Final"].Rows)
{
string sql = "";
if (dr["user_id"] != null && dr["user_id"] != System.DBNull.Value && dr["user_id"].ToString().Trim() != string.Empty)
{
sql = "INSERT INTO USER_MASTER (USER_ID,PASSWORD,FNAME,LNAME,ADDRESS1,ADDRESS2,CITY_ID,STATE_ID,COUNTRY_ID,EMAIL,EMAIL_VERIFIED) values(" + dr["user_id"] + ",'password','" + dr["user_firstname"] + "','" + dr["user_lastname"] + "','" + dr["user_address_1"] + "','" + dr["user_address_2"] + "'," + dr["user_region_id"] + "," + dr["user_state_id"] + "," + dr["user_cid"] + ",'" + dr["user_email"] + "',1)";
SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString, CommandType.Text, sql);
}
}
}
}
catch (Exception ex)
{
lblError.Text = ex.Message;
}
}
}
Regards,
Mayank Parmar
Senior Software Engineer
Amba Tech
Gandhinagar, India
|
|
|
|
|
I will created dynamic check boxes in panel but it losing the checked values when i reloads
Example :
no problem with bind data but when i click submit i need to reload the binddata() definitely other wise panel doesn't show any items.
if i reload then checked values are losing when i calling the submit button.
sub binddata()
dim ds as dataset // here i will take data source from which from database.
Try
ds=obj.GetSource()
For index = 0 To ds.Tables(0).Rows.Count - 1
chklist = New CheckBox
chklist.Text = ds.Tables(0).Rows(index).Item(0).ToString
chklist.ID = ds.Tables(0).Rows(index).Item(0).ToString
chklist.EnableViewState = True
Panel1.Controls.Add(chklist)
Panel1.Controls.Add(New LiteralControl(" "))
Next
end sub
problem below when i reloads the databind(). but i need to be definitely reloads the databind other wist panel doen't show any thing
Private Sub submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submit.Click
While index < ds.Tables(0).Rows.Count
DisplayPanel = CType(FindControl("panel1"), Panel)
chklist1 = CType(DisplayPanel.FindControl(ds.Tables(0).Rows(index).Item(0).ToString), CheckBox)
If Not chklist1 Is Nothing Then
chklist1.Text = ds.Tables(0).Rows(index).Item(0).ToString
If chklist1.Checked = True Then //here showing that not checking even thought i will check check boxes
objWeb.Addid(drlist.SelectedItem.Value, chklist1.ID)
End If
End If
index = index + 1
End While
end sub
this is haneef
|
|
|
|
|
how do i do full text search on a dataset
without using sql server full text search
can any one give me code
|
|
|
|
|
<br />
SELECT MT.strTextFildColumn<br />
FROM MyTable MT WITH (NOLOCK)<br />
WHERE MT.strTextFildColumn LIKE '%searhText%'<br />
This will search the strTextFildColumn for all the rows that contains the
text searhText.
if you change it to:
WHERE MT.strTextFildColumn LIKE 'searhText%'
it will search the strTextFildColumn for all the rows that starts with the
text searhText.
if you change it to:
WHERE MT.strTextFildColumn LIKE '%searhText'
it will search the strTextFildColumn for all the rows that ends with the
text searhText.
Hope it helps
Thomas
|
|
|
|
|
i have one excel need to upload to mySQL thru asp.net web application. How to import excel file to mySQL ? or how to import excel to datatable or xml? because alternatively i have code to convert xml to mysql.
Thanks.
Regards,
Chee ken
|
|
|
|
|
I am not sure if following is helpful or not but I first converted Excel file int .CSV using MS-Excel and then used following query.
LOAD DATA LOCAL INFILE '<file path="" and="" name="">' INTO TABLE FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n';
My query
LOAD DATA LOCAL INFILE 'C:\\ukpostcodes\\uk.pc.ll.csv' INTO TABLE postcodes FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n';
|
|
|
|
|
Hi all ,
I am developing a web project which has two phases (English,andArabic).
The english phase works well. The problem in the arabic one which appears in strange letters .
The strange in the matter is that the arabic project works good in localhost but when upload it to the server it appears as strange symbols.
I added the line below and the problem still .
Can any one help me ...
|
|
|
|
|
Does the server have the appropriate language pack installed?
|
|
|
|
|
Hello,
I have made a javascript code for validating some inputs when the user click on an insert button which inserts a new row in a database but i can't
associate the script function to the "onclick" event because it hase an other event I have tried an html server button but it doesn't work.
thanks.
Dad
|
|
|
|
|
Try OnClientClick event
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|