|
hai,
thanks for ur reply,Here i am not using any type of Grid,Just a simple form having txt's and ddl's and label's.
Can u please suggest me some idea.How can i refresh the data which is already sent to database.THe refresh shd shown while i am navigating the buttons.The last entered record is not appearing at that perticular parse.If i close the form and if i again open,then it is coming.
I want after immediate insertion the data shd be refresh
Regards
kissy
|
|
|
|
|
hi.
Post some code. Let's see what you are doing.
Are you doing the data retrieval again after the insert?
|
|
|
|
|
I display some boolean values in checkboxes. Is it possible instead of the checkboxes the values to displayed as On if the database cell=True or Off if the value=False.
Also if all the values in a column are the same e.g kjaslklkajl. Is it possible to represent this colunm with different value? kjaslklkajl=Some Name.
Thanks
|
|
|
|
|
How come you are displaying values in the checkboxes? U'r question is not clear ...
Koushik
|
|
|
|
|
HI,
Make autogeneratecolumns property of gridview to false.
and create <asp:BoundField> for each of the column you need to display.
This way your boolean column will display "True" and "False" in the gridview.
Now you can change this to "On" and "Off" by writing code in the "RowDataBound" event of the gridview.
protected void gvDemo_RowDataBound(object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[2].Text == "True")
{
e.Row.Cells[2].Text = "On";
}
else
{
e.Row.Cells[2].Text = "Off";
}
}
}
set OnRowDataBound = "gvDemo_RowDataBound" in the gridview.
The code for your sencond problem can also be written here only cellindex will be changed.
I hope this will help you.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
I use VB.net but this code is exactly what I need.
Thank you guys.
|
|
|
|
|
Hello ALL!
I have a problem and I didnt find an aswer into articles.
I have a datalist, a sqldatasource and a page.
I should select some data from database and display it on the page using datalist.
I can do it.
But i should add a footer for navigation into my datalist beacause when page loaded datalist has ALL rows from query but it must be dispalying only for 20 rows on the first page, 20 on the next page e.t.c. and I would like change current page (like in a gridview).
I cant use gridview because my items should be displaing like:
(first row)
item1 item2
(second row)
item3 item4
...
(20th row)
item39 item40
first page prev. page next page last page.
but when I use griedview I got only:
(first row)
item1
(second row)
item2
...
(20th row)
item20
(because in the griedview next item dispalying only on the NEXT page)
or
(first row)
item1 item1
(second row)
item2 item2
...
(20th row)
item19 item20
(i tryed display two items in one itemtemplate but I got two same items in each row )
I really hope you undestand me and can help me. it is really important task for me and sorry my English.
thanx!
--
"Success is simple. Do what's right, the right way, at the right time."
best regards,
tradakad
|
|
|
|
|
You can achieve the functionality of the gridview paging in datalist using
'PagedDataSource'...at first attach your rows to PagedDataSource object and then bind the PagedDataSource to datalist...
Koushik
|
|
|
|
|
thanx!? but can you tell more deatils or show a simple example? i'm not sure i understood you
--
"Success is simple. Do what's right, the right way, at the right time."
best regards,
tradakad
|
|
|
|
|
 Hey for eg:You have got a table(say 'dt') retrieved from the database...
Now bind it to PagedDataSource.
public partial class Default4 : System.Web.UI.Page <br />
<br />
{<br />
<br />
<br />
DataTable dt = null;<br />
protected int currentpage = 0;<br />
<br />
protected void Page_Load(object sender, EventArgs e)<br />
<br />
{<br />
<br />
#region Datalist binding with PagedDataSource<br />
<br />
<br />
PagedDataSource ps = new PagedDataSource();<br />
ps.DataSource = dt.DefaultView;<br />
ps.AllowPaging = true;<br />
<br />
ps.PageSize = 2;<br />
<br />
if (Request.QueryString["Page"] != null)<br />
{<br />
currentpage = Convert.ToInt32(Request.QueryString["Page"]);<br />
<br />
}<br />
else<br />
{<br />
currentpage = 1;<br />
}<br />
<br />
ps.CurrentPageIndex = currentpage - 1;<br />
Label1.Text = "Page:" + currentpage;<br />
<br />
if(!ps.IsFirstPage)<br />
{<br />
PrevLink.NavigateUrl = Request.CurrentExecutionFilePath +"?Page=" +(currentpage - 1);<br />
}<br />
<br />
if (!ps.IsLastPage)<br />
{<br />
NextLink.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" +(currentpage + 1);<br />
}<br />
<br />
<br />
<br />
<br />
DataList1.DataSource = ps;<br />
DataList1.DataBind();<br />
<br />
<br />
#endregion<br />
<br />
<br />
}
In the above example prevlink and nextLink are the Hyperlinks in your page
Koushik
|
|
|
|
|
thanx! i'll try it it in the evening and i'll post a result here. thanx!
--
"Success is simple. Do what's right, the right way, at the right time."
best regards,
tradakad
|
|
|
|
|
hi
i have some hyperlinks that show news title, i want when user click on hyperlink redirect to another page and pass some values to that page, but how to do ?
Note : i want when user click on hyperlink, i retrieve id of it and pass to another page, but in *.aspx how to retrieve ID from database and pass to another page by hyperlink ?
|
|
|
|
|
Hi,
You should write your logic of retrieving ID from the database in the "Page_Load" event and set the hyperlink's navigatUrl property.
hyperlink.NavigateUrl = "targetpage.aspx?ID" + ID.ToString();
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Also refer Urlencode functionality.
Regards,
Arun Kumar.A
|
|
|
|
|
Arun.Immanuel wrote: Also refer Urlencode functionality
Also refer Urlencode functionality
thanks .. my problem was solved, but how to use Urlencode functionality ??
plz give an example. thanks
|
|
|
|
|
hyperlink.NavigateUrl = "targetpage.aspx?ID" + Server.UrlEncode(ID.ToString());
Generally , "&" is the delimiter for querystrings.
So, if ID="Good&Bad" , then while retrieving U will get "Good" alone.
hope, I have explained it clearly.
Regards,
Arun Kumar.A
|
|
|
|
|
hi,i have one doubt regarding page class methods.my doubt is when to use RegisterStartupScript() and RegisterClientScriptBlock() methods.what is the major difference between the two methods?.please give suggestions for where those best suited.
|
|
|
|
|
I Don't know much about this two except
The RegisterClientScriptBlock method adds a script block to the top of the rendered page.
Whereas
The script block added by the RegisterStartupScript method executes when the page finishes loading but before the page's OnLoad event is raised.
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
SqlConnection myConnection =
new SqlConnection(connstring );
SqlDataAdapter myAdapter =
new SqlDataAdapter(
"SELECT ProductID, ProductName, QuantityPerUnit, UnitPrice FROM Products",
myConnection);
//Fill the DataSet
DataSet ds = new DataSet();
myAdapter.Fill(ds,"Products");
//DataBind the Repeater
// MyRepeater.DataSource = ds.Tables["Products"].DefaultView;
// MyRepeater.DataBind();
// Populate the repeater control with the Items DataSet
PagedDataSource objPds = new PagedDataSource();
objPds.DataSource = ds.Tables[0].DefaultView;
objPds.AllowPaging = true;
objPds.PageSize =10;
objPds.CurrentPageIndex = CurrentPage;
lblCurrentPage.Text = "Page: " + (CurrentPage + 1).ToString() + " of "
+ objPds.PageCount.ToString();
// Disable Prev or Next buttons if necessary
cmdPrev.Enabled = !objPds.IsFirstPage;
cmdNext.Enabled = !objPds.IsLastPage;
MyRepeater.DataSource=objPds;
MyRepeater.DataBind();
this is my code what is the use of( ds.Tables[0].DefaultView)this;
can u explain me??
regards
saravanan
|
|
|
|
|
I tmeans that the first table in the dataset is to be attached to the datasource of the control...DefaultView property returns a DataView you can use to sort, filter, and search a DataTable...
for eg... ds.Tables[0].DefaultView.RowFilter = "city='New York'"
Koushik
|
|
|
|
|
ds.Tables[0].DefaultView referes to opening view or customized view of the table that may include a filtered view, or a cursor position.
|
|
|
|
|
how to make a control visible and hidden when i click a button
thks
|
|
|
|
|
Hi
Takae look at it
<br />
document.getElementById(groupid).style.display=="none"<br />
document.getElementById(groupid).style.display="block";<br />
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
Hi,
To hide the Contorl use the following code in javascript:
document.getElementById("controlName").style.visibility = "hidden";
To Visible the control use the following code in javascript:
document.getElementById("controlName").style.visibility = "visible";
Regards,
Sandeep Kumar.V
|
|
|
|
|
i will attend an online exam of .net next week of a big company. It will be too difficult. How can pass and how can i prepare for that and can i get some sample questions.
Thanks
yesu
|
|
|
|