|
Hi,
you can write query like.
SELECT column1 + '-' + column2 AS MyColumn FROM tableName
Now after getting value in dataset. Bind dataset to listbox.
myList.DataSource = datset
myList.DataTextField = "MyColumn";<br />
myList.DataBind();<br />
Thanks,
Sun Rays
To get something you must have to try once.
My Articles
|
|
|
|
|
Why don't you use GridView or something?
|
|
|
|
|
AFAIK, You can't use columns inside a listbox. Try using GridView/DataGrid
|
|
|
|
|
Hi all,
I want to port the .dbf files into Sqlserver.
The requirement are as such that
The user should be able to specify the name of Database and login Credential prior to porting the files into the Database.
we are using Visual Studio 2005 as developoemnt platform.
Please suggest us the possible way for that i can achieve my target.
Thanks and Regards
Avesh Agarwal
|
|
|
|
|
hi all
I have
string strDemo = "abc";
string strDemo1 = "abc def ghjk abcde";
I want check if strDemo1 have character is same strdemo return true else false.
Same query Like N'%%' in sqlserver
how can i do ??
|
|
|
|
|
The Contains method on the string class
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
- Get the length of strDemo
- Cut the string according to the lenght of strDemo from strDemo1
- compare strDemo and strDemo1 (which has been cut)
|
|
|
|
|
Oh. I didn't see the Christian's reply.
ya. Christian's method might be better for you.
|
|
|
|
|
How can we use 2 sitemaps in an aspx page?
|
|
|
|
|
Hello,
Definitely, you may have multiple site map paths for a single website or a page. To configure multiple site maps for a single site, start with a site map in the root of your application. Next, configure the root provider as the default site-map provider in your Web.config file. Then, link to child site maps or providers by referencing them in a SiteMapNode object. Here is a good link which I have used to create one:
http://msdn2.microsoft.com/en-us/library/ms178426.aspx
Do let me know if this works for you or not.
Best Regards,
Sam Xavier
www.componentone.com
|
|
|
|
|
Hi,
I want to create an application “Message Board “like code project. When any user can ask question and can view the answer like given in Code project. Please give me idea to develop such type of allocation or send me link.
Regards
Rajesh
rajesh
|
|
|
|
|
Buy a book on ASP.NET and work through it. Buy a book on SQL and databases, and work through it. If you want the sort of features CP has, buy a book on javascript and DHTML and work through it.
Christian Graus - Microsoft MVP - C++
"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 all
I have some code is VB.net but i dont understant it
Dim strdemo as String
strdemo = "demo"
Dim strdemo1 as String
strdemo = "demo1"
If Ucase(strdemo ) Like "*" & Ucase(strdemo1 ) & "*" Then
END IF
If i convert this code to C#. How can i do that??.
|
|
|
|
|
This needs to be in the VB forum.
|
|
|
|
|
Basically, the person who wrote this has no idea how to use .NET. Methods like Ucase should never be used.
I think this belongs in the C# forum, it sure doesn't belong here. It has nothing to do with ASP.NET
Christian Graus - Microsoft MVP - C++
"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 there,
I have specified users to my web site designed using ASP.net over VB
But actually number of users needed to be larger than they are be added via normal ASP.net configuration, and I need to take them from my database
example : I have a table containing all employees I want them to access my site authenticated and authorized
How can I make them login with there usernames and passwords saved in that table
note : the database used is SQL
I hope that I explained it right
urgent help is needed
There is always something to learn
|
|
|
|
|
Surely the built in control can do that ? If not, you need to write your own solution.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
thanks a lot
I am trying it now
There is always something to learn
|
|
|
|
|
Hi,
When I export grid view to excel in asp.net 2.0. It successfully exported but I did localization.
I want to save exported excel file name save in Korean language. When I put file name in Korean language like
protected void ExportGridView(Control grdView, string strFileName)
{
string attachment = "attachment; filename="??".xls";
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
grdView.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
}
The out put comes like “리í´.xls” but I want to save like “??.Xls”
How can I do this to save file name as korean language .
Regards
Rajesh
rajesh
|
|
|
|
|
Thanks to Abisodun and Mike for answering my previous post. Both of the answers was directed to the 2nd part of my question. On the first part, I still need help. So - here's it again:
I am using MultiView / View controls which change by MenuItem clicks. Each view has a GridView on it with Edit and Insert features.
The problem is: when the edit button is clicked, the GridView disappears and you need to click on the MenuItem again to see it (it happens evrytime you click edit, update, cancel or insert buttons on the GridView).
Any ideas?
Thanks.
Ekjon
|
|
|
|
|
As I said in previous post, you might miss to bind the dataset in your pageload after postback...
Can you show us what you wrote in PageLoad and Edit event?
|
|
|
|
|
Hi Michael,
Here's what I'm doing: for the common part of the page, I am using dataset to populate some textbox controls, then for the details part - I'm using GridViews with a SqlDataSources. Each of the GridViews are placed on a View control being changed by MenuItem clicks. Here are some code:
protected void Page_Init(object sender, EventArgs e)
{
projectId = Convert.ToInt32(Session["ClickedId"]);
string [] dataKeys = {"MethodSID"};
conn = new SqlConnection();
// Get the ConnectionString dynamically
conn.ConnectionString = ConfigurationManager.ConnectionStrings["EEM-NEWConnectionString1"].ConnectionString;
dsrcMethods.ConnectionString = conn.ConnectionString;
Parameter param;
dsrcMethods.UpdateCommand = "update tblMethod set MethodName=@MethodName, MethodDesc=@MethodDesc,"
+ "TaxonomicalKeys=@TaxonomicalKeys, TaxonomicalDesc=@TaxonomicalDesc"
+ " where MethodSID=@MethodSID and ProjectID=" + projectId;
dsrcMethods.InsertCommand = "insert into tblMethod (ProjectID, MethodName, MethodDesc, TaxonomicalKeys,"
+ " TaxonomicalDesc) values (" + projectId + ",@MethodName,@MethodDesc,"
+ " @TaxonomicalKeys,@TaxonomicalDesc)";
param = new Parameter("MethodSID", TypeCode.Int32);
dsrcMethods.UpdateParameters.Add(param);
param = new Parameter("MethodName", TypeCode.String);
dsrcMethods.UpdateParameters.Add(param);
dsrcMethods.InsertParameters.Add(param);
param = new Parameter("MethodDesc", TypeCode.String);
dsrcMethods.UpdateParameters.Add(param);
dsrcMethods.InsertParameters.Add(param);
param = new Parameter("TaxonomicalKeys", TypeCode.String);
dsrcMethods.UpdateParameters.Add(param);
dsrcMethods.InsertParameters.Add(param);
param = new Parameter("TaxonomicalDesc", TypeCode.String);
dsrcMethods.UpdateParameters.Add(param);
dsrcMethods.InsertParameters.Add(param);
gvMethods.DataKeyNames = dataKeys;
gvMethods.DataSourceID = dsrcMethods.ID;
}
protected void Page_Load(object sender, EventArgs e)
{
txtID.Focus();
txtID.Enabled = false;
txtTitle.Enabled = false;
txtAbstract.Enabled = false;
txtJust.Enabled = false;
txtSponsor.Enabled = false;
txtStartDate.Enabled = false;
txtStatus.Enabled = false;
txtEndDate.Enabled = false;
txtProgress.Enabled = false;
txtAck.Enabled = false;
if (!Page.IsPostBack)
{
conn.Open();
try
{
txtID.Text = projectId.ToString();
// Create SqlCommand and Parameter to select ProjectID
cmd = new SqlCommand("Select * from tblProject where ProjectSID=@ProjectID", conn);
cmd.Parameters.Add("@ProjectID", SqlDbType.Int);
cmd.Parameters["@ProjectID"].Value = projectId;
dsProject = new DataSet();
da = new SqlDataAdapter(cmd);
da.Fill(dsProject);
cmd.ExecuteReader();
// If there are no records for the user
if (dsProject.Tables[0].Rows.Count == 0)
{
lbl = new Label();
lbl.Text = "<p>You do not have any data for this Project</p>";
Controls.Add(lbl);
}
else
{
txtTitle.Text = dsProject.Tables[0].Rows[0].ItemArray[1].ToString();
txtAbstract.Text = dsProject.Tables[0].Rows[0].ItemArray[2].ToString();
txtJust.Text = dsProject.Tables[0].Rows[0].ItemArray[3].ToString();
txtSponsor.Text = dsProject.Tables[0].Rows[0].ItemArray[4].ToString();
txtStartDate.Text = dsProject.Tables[0].Rows[0].ItemArray[5].ToString();
txtStatus.Text = dsProject.Tables[0].Rows[0].ItemArray[6].ToString();
if (dsProject.Tables[0].Rows[0].ItemArray[7].ToString() == null ||
dsProject.Tables[0].Rows[0].ItemArray[7].ToString() == "")
txtEndDate.Text = "Not Applicable";
else
txtEndDate.Text = dsProject.Tables[0].Rows[0].ItemArray[7].ToString();
txtProgress.Text = dsProject.Tables[0].Rows[0].ItemArray[8].ToString();
txtAck.Text = dsProject.Tables[0].Rows[0].ItemArray[9].ToString();
}
// Cleanup command and connection objects.
dsProject.Dispose();
da.Dispose();
cmd.Dispose();
conn.Close();
}
catch (Exception ex)
{
// Add error handling here for debugging.
Response.Write(ex.Message);
//System.Diagnostics.Trace.WriteLine("[ValidateUser] Exception " + ex.Message);
}
}
}
protected void mnuProjectDetails_MenuItemClick(Object sender, MenuEventArgs e)
{
gvMethods.Focus();
// Get the MenuItem Clicked
int item = Int32.Parse(e.Item.Value);
if (item == 0)
{
conn.Open();
dsrcMethods.SelectCommand = "select * from tblMethod where ProjectID=" + projectId;
conn.Close();
}
else if (item == 1)
{
conn.Open();
dsrcTools.ConnectionString = conn.ConnectionString;
dsrcTools.SelectCommand = "select * from tblTool t, tblMethod m where m.MethodSID=t.MethodID and"
+ " m.ProjectID=" + projectId;
gvTools.DataSourceID = dsrcTools.ID;
conn.Close();
}
MultiView1.ActiveViewIndex = Int32.Parse(e.Item.Value);
}
Thanks for taking your time and I'm positive that you can find something for me.
|
|
|
|
|
Try like that..
In Page_load
<br />
if (!Page.IsPostBack){<br />
}<br />
else{<br />
}<br />
|
|
|
|
|
I know it is embarrassing to ask such a question but how do you navigate in your page?? ie. backward, forward or load a specific url in the same page "I'm using Process.Start("www.url.com");" but I dont want a new page/tab, I want to load it in the same page..
Thank you guys
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
If you're using Process.Start, it's not going to work when you deploy your site, as it's launching on the server, not the client. Server.Transfer and Response.Redirect are how it's done. The difference is that Server.Transfer doesn't do another round trip and therefore the URL in the users browser does not change.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|