|
If DataSet.Tables.Count > 0 Then
dtTable = DataSet.Tables(0)
objList = CType(drpDropDown, System.Web.UI.WebControls.DropDownList)
With objList
.Items.Clear()
.DataValueField = "value"
.DataTextField = "text"
dtRow = dtTable.NewRow()
dtRow(0) = -1
dtRow(1) = "--Select--"
dtTable.Rows.InsertAt(dtRow, 0)
.DataSource = DataSet
.DataBind()
End With
|
|
|
|
|
Hi all
thanks for the replies, wish my other posts got this many repliers!!
I had to add in 'select' into my select statement so it set the value as select
cheers
thanks
|
|
|
|
|
Hi all,
I m newbie to Asp.net(Vb) , In my application i want to formt grid view using html code like this
<br />
Dim dt As New DataTable<br />
Dim dc As New DataColumn<br />
<br />
dc.DataType = GetType(String)<br />
dc.ColumnName = "Description"<br />
<br />
dt.Columns.Add(dc)<br />
<br />
Dim dr As DataRow<br />
dr = dt.NewRow<br />
<br />
dr.Item("Description") = "<html><body><font color=red>Text will goes here</font></body></html>"<br />
dt.Rows.Add(dr)<br />
<br />
Me.GridView2.DataSource = dt<br />
Me.GridView2.DataBind()<br />
but the DataRow doesn't have the text property so it doesn't treat html as code it display as it is .
I know i can user gridview.row(0).item(0).text to do it but it becomes difficult to manage paging in gridview
I hope someone will understand my problem so i m looking forward for your resoponse
Thanks with anticipation
|
|
|
|
|
Its something you have to do with the GridViewColumn's property.
You have set the HtmlEncode property to False.
|
|
|
|
|
Thank you so much Venkatesh Mookkan
Your guidance is great, My problem has been solved because of your help after frustation of 3 days hard working to solve this problem
Thanks a lot once again
|
|
|
|
|
You are welcome. And one more suggestions.
Please reduce the usage of the smileys while you explaining your problems/suggestions. It may annoy the reader if they are too many.
Its ok for me. But not all the peoples think like me.
|
|
|
|
|
I used Smilleys just for fun! and express the feelings but anyways i'll keep in mind your suggestion next time
|
|
|
|
|
Hi dears,
I am developing a web portal with ASP.NET 2.0 and c#
my protal has several phases such as personal pages,magazine,shopping,news,...
I want to make subdomain for each above subjects. Then I created a subdomain named "pages" in my host control panel to redirect any pages.mywebsite.com to mywebsite.com/pages/ address.
when I upload my default.aspx file to pages subdirectory and visite pages.mywebsite.com/default.aspx "the resource is not found" error accurs. but when I upload any html file to pages subdirectory I can access any of them correctly . I realy don`t know what the problem is.
kindly help me plz. ( sorry for my bad english)
www.behzadi.net
|
|
|
|
|
rdr is a SqlDataReader.
rdr have a table in which data are
"select BestForName,BestForID from BestForTable"
ddlBestFor is a drop down list.
when I try
ddlBestFor.items.add(rdr["BestForName"]);
I'm getting for ddlBestFor
text : all BestForName
value: 0,1,2,........
But I want to add like
text : all BestForName
value: all BestForID
I need hardly.
thanks a lot.
You get the best out of others when you give the best of yourself.
|
|
|
|
|
Use the following code
objDataSet will have the set of records which are retrived using select query.
ddlBestFor.DataValueField = objDataSet.Tables[0].Columns[1].ToString();
ddlBestFor.DataTextField = objDataSet.Tables[0].Columns[0].ToString();
ddlBestFor.DataSource = objDataSet.Tables[0];
ddlBestFor.DataBind();
ddlBestFor.Items.Insert(0, "Select");
Bhanu
|
|
|
|
|
u have to set DataValue property also along with DataText
one way of doing this is the mentioned by other fellow in the above post
|
|
|
|
|
Hello Everybody,
I have GridView like below:
Name CustomerID Send
Rakesh 01234 Send
In this "Send" is a LinkButton. I need to develope it like when a user click on "Send", page should be redirect to a different page and value of "CustomerID" should go to the redirect page like Querystring.
Thanks in Advance
Happy Coding
A key to every Solution
|
|
|
|
|
Set your Link button's PostBackUrl into your redirect Page.
Get the CustomerId value By "PreviousPage" object
r_palanivel83 10:01 4 Jan '06
|
|
|
|
|
Thanks for reply.
But how can I get the CustomerID value from PreviousPage Object. That value should be the particular row value where the LinkButton is clicked.
plz if possible give me a sample.
Happy Coding
A key to every Solution
|
|
|
|
|
add onclick event for send button and calls a method written in code file
in that method just write
Response.Redirect("secondpage.aspx?"id) // id is the customerid passed from .aspx page
for example (.aspx file)
OnClick='<%# GetCommentURL(Eval("ArticleID").ToString()) %>'
(.cs file)
protected string GetCommentURL(string id)
{
return "Comments.aspx?id=" + id;
}
modified on Tuesday, January 29, 2008 3:01:18 AM
|
|
|
|
|
why don't you set linkbutton.commandargument = customerid
in itemdatabound/rowdatabound eventhandler
then set linkbutton.commandname = "send" in property page
then add itemcommand/rowcommand eventhandler
in this handler add this code
if (e.commandname == "send")
{
DoWhatYouWantToDo(e.commandargument);
}
i hope it helps
|
|
|
|
|
How to prevent a gridview row on viewing the data.If we have a data in a grid.I want to prevent the data on viewing..How is it possible.Please reply..
|
|
|
|
|
Place your Gridview inside the tag and set the div propery as follow
r_palanivel83 10:01 4 Jan '06
|
|
|
|
|
I made a simple report CrystalReport1.rpt which was added to my project
Now I want to use this report in my project:
CrystalReport1 = new CrystalReport1();
But I get this compile-error:
The type or namespace name 'CrystalReport1' could not be found (are you missing a using directive or an assembly reference?)
What is wrong?
|
|
|
|
|
What has this got to do with ASP.NET?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
i have exported file to Excel......nw i need to retrieve the same excel file to my asp.net application
My excel file is like the given below :-
AssetID Description AssetTag
1246 hello me(1246) 10103001245
1247 hi me(1247) 10103001246
when am trying to import, am getting an error like " External table is not in the expected format "
wht might be the prblm.....
can anyone help me?
|
|
|
|
|
add this code
Response.Clear();
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("content-disposition", "attachment;filename=DCNReport.xls");
Response.Charset = "";
this.EnableViewState = false;
r_palanivel83 10:01 4 Jan '06
|
|
|
|
|
This is for while exporting the file.....
my code is like ths:-
Dim excelname As String = FileUpload1.PostedFile.FileName
Dim intFileNameLength As Integer = InStr(1, StrReverse(excelname), "\")
strFileName = Mid(excelname, (Len(excelname) - intFileNameLength) + 2)
Dim namewe As String = System.IO.Path.GetFileNameWithoutExtension(strFileName)
Dim sWorkbook As String = namewe + "$"
FileUpload1.PostedFile.SaveAs(Server.MapPath("ImportFiles/") + namewe + ".xls")
Dim oledbconn As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("ImportFiles/") + namewe + ".xls ;Extended Properties=Excel 8.0;")
Comm.CommandText = "SELECT AssetID,Description,AssetTag FROM [" & sWorkbook & "]"
Comm.CommandType = Data.CommandType.Text
Comm.Connection = oledbconn
oledbadap.SelectCommand = Comm
oledbadap.Fill(oledbdatatbl)
GrdImpScanner.DataSource = oledbdatatbl.DefaultView
GrdImpScanner.DataBind()
am getting the error in this line :-
" oledbadap.Fill(oledbdatatbl) "
|
|
|
|
|
im trying to use the update panel but it updates the entire page as supposed to the update panel. i cant find what i have done wrong. can anyone help???
Many thanks in advance
====================================================================================
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager id="ScriptManager1" runat="server">
</asp:ScriptManager>
</div>
<asp:UpdatePanel id="UpdatePanel1" runat="server">
<contenttemplate>
<asp:Label id="Label1" runat="server" Text="panel Created"></asp:Label>
</contenttemplate>
<triggers>
<asp:AsyncPostBackTrigger ControlID="Button1"></asp:AsyncPostBackTrigger>
</triggers>
</asp:UpdatePanel>
<asp:Button ID="Button1" runat="server" Text="Button" />
</form>
</body>
</html>
===========================code behind================
Protected Sub Button1_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = "Refreshed at " & _
DateTime.Now.ToString()
End Sub
|
|
|
|
|
you can always try another method in using updatepanel.
example :
aspajax:updatepanel id="upGetContract" updatemode="conditional" runat="server"
contenttemplate
contenttemplate
triggers
aspajax:asyncpostbacktrigger controlid="btnSearch" eventname="Click"
triggers
aspajax:updatepanel
hope it help
nb : i dont know why if i give "<" or ">" the code will not be shown...
but i believe u got what i mean
|
|
|
|