|
Hi Srinandan,
Set the page count to Last page
gr.CurrentPageIndex=gr.PageCount-1;
gr.Rows.Count You will get the rows on the last page .
|
|
|
|
|
Hi ,
One of my pages contains master page.I dont want it anymore.Is there anyway to remove it from my page ?
|
|
|
|
|
Subin Mavunkal wrote: One of my pages contains master page.
Remove the ASP:Content Tage. Use Normal HTML Tag like other pages.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I created a textbox.....
i want to bold text in textbox, suppose this is a text in textbox "My Name is Arun".....so i want "Arun" in bold and rest the same......
Any Help ?
Thanks in advance
|
|
|
|
|
Have you tired with My Name is <b>Arun</b> ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
This will not work in a normal textbox control.
|
|
|
|
|
I am afraid it is impossible to do that.
You can use other controls or div with <b></b>.
April
Comm100 - Leading Live Chat Software Provider
modified 27-May-14 21:48pm.
|
|
|
|
|
As far as i know, you cannot do this in a normal textbox control.
Try to use some HTML Editor control.
|
|
|
|
|
Hi All,
I am designing the new project.
My question how to maintain the navigation.
Suppose I have to write in page
Response.Redirest("Setting.aspx");
but what my page name changes.
so i have to change every where.
Can u suggest any idea to solve problem.ony way is through class. is there any better way.
Thanks and regards,
Amit Patel
|
|
|
|
|
If you are mentioning the page name and if it changed then you have to change every where. You can also pass page name as argument.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
if you are using Master Pages then you can only change it in one place. here is more info about master pages
http://www.asp.net/Learn/master-pages/[^]
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi,
you can try Server.transfer("Setting.aspx");
modified 27-May-14 5:11am.
|
|
|
|
|
Hi to all,
I am using DetailsView control to edit the details of the user. But when I click the Edit button, the update button is not clickable. I am unable to find out the problem.
<br />
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" <br />
CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333" <br />
GridLines="None" Height="50px" Width="364px" <br />
AutoGenerateEditButton="True" DataKeyNames="UserId" <br />
style="margin-right: 0px" onitemupdating="DetailsView1_ItemUpdating"><br />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><br />
<CommandRowStyle BackColor="#E2DED6" Font-Bold="True" /><br />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" /><br />
<FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" /><br />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /><br />
<Fields><br />
<asp:BoundField DataField="UserId" HeaderText="UserId" ReadOnly="True" SortExpression="UserId" /><br />
<asp:BoundField DataField="first_name" HeaderText="first_name" SortExpression="first_name" /><br />
<asp:BoundField DataField="last_name" HeaderText="last_name" SortExpression="last_name" /><br />
<asp:BoundField DataField="AddressLine1" HeaderText="address1" SortExpression="AddressLine1" /><br />
<asp:BoundField DataField="AddressLine2" HeaderText="address2" SortExpression="AddressLine2" /><br />
<asp:BoundField DataField="AddressLine3" HeaderText="address3" SortExpression="AddressLine3" /><br />
<asp:BoundField DataField="zipcode" HeaderText="zipcode" SortExpression="zipcode" /><br />
<asp:BoundField DataField="city" HeaderText="city" SortExpression="city" /><br />
<asp:BoundField DataField="state" HeaderText="state" SortExpression="state" /><br />
<asp:BoundField DataField="country" HeaderText="country" SortExpression="country" /><br />
<asp:BoundField DataField="landline" HeaderText="landline" SortExpression="landline" /><br />
<asp:BoundField DataField="mobile" HeaderText="mobile" SortExpression="mobile" /><br />
</Fields><br />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><br />
<EditRowStyle BackColor="#999999" /><br />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" /><br />
</asp:DetailsView><br />
<br /><br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" <br />
ConnectionString="<%$ ConnectionStrings:newcon %>" <br />
<br />
SelectCommand="SELECT [First_Name], [State], [City], [AddressLine3], [AddressLine2], [AddressLine1], [Last_Name], [Country], [Landline], [Zipcode], [Mobile],[UserId] FROM [USERS] WHERE ([UserId] = @UserId)"<br />
UpdateCommand="UPDATE [USERS] SET [First_Name] = @First_Name, [State] = @State, [City] = @City, [AddressLine3] = @AddressLine3, [AddressLine2] = @AddressLine2, [AddressLine1] = @AddressLine1, [Last_Name] = @Last_Name, [Country] = @Country, [Landline] = @Landline, [Zipcode] = @Zipcode, [Mobile] = @Mobile WHERE [UserId] = @UserId" ><br />
<br />
<SelectParameters><br />
<asp:Parameter Name="UserId" /><br />
</SelectParameters><br />
<UpdateParameters><br />
<asp:Parameter Name="UserId" /><br />
<asp:Parameter Name="First_Name" Type="String" /><br />
<asp:Parameter Name="State" Type="String" /><br />
<asp:Parameter Name="City" Type="String" /><br />
<asp:Parameter Name="AddressLine3" Type="String" /><br />
<asp:Parameter Name="AddressLine2" Type="String" /><br />
<asp:Parameter Name="AddressLine1" Type="String" /><br />
<asp:Parameter Name="Last_Name" Type="String" /><br />
<asp:Parameter Name="Country" Type="String" /><br />
<asp:Parameter Name="Landline" Type="String" /><br />
<asp:Parameter Name="Zipcode" Type="String" /><br />
<asp:Parameter Name="Mobile" Type="String" /><br />
</UpdateParameters><br />
</asp:SqlDataSource><br />
cheers,
sneha
|
|
|
|
|
Hi Sneha ,
Be little more specific what is the problem
|
|
|
|
|
Hi Nishant,
In the edit mode of the details view we have two buttons, update and cancel.
Cancel is working fine. But the update button is not working.It is not clickable. Nothing is happening when I click on it.
I even created a new page and applied the same code but of no use. I used details view several times but this time I am not able to solve the problem. If it is not updating the data, I can understand but the update button is not clickable is a strange behaviour.
cheers,
sneha
|
|
|
|
|
Got the problem .....but not sure what exactly is causing the problem ,
Have u associated any event with update Command , or just check anywhere it is getting disabled or something in Control Render events.
|
|
|
|
|
I checked the page source. I think here is the problem. The update button is this:
<br />
<a href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$DetailsView1$ctl12", "", true, "", "", false, true))" style="color:#333333;">Update</a><br />
I think it should be:
<br />
<a href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$DetailsView1$ctl12','')" style="color:Black;">Update</a><br />
cheers,
sneha
|
|
|
|
|
sneha Choudhary wrote: But the update button is not working.
oops ..! Sorry You Used the other way which you cant keep break point i didnt check it..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
I have a big GridView (with, edit,update,delete and insert operations),(forgive all this code, I cant present my problem other way
The template field is like this: (the gridview has OnPageIndexChanging="GridView3_PageIndexChanging" OnSorting="GridView3_Sorting" AllowSorting="True" properties)
<asp:TemplateField HeaderText="Nome" SortExpression="Nome">
<EditItemTemplate>
<asp:TextBox ID="txtname" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblname" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNName" runat="server" width="75px" Visible='<%# (bool) show_hide_insert() %>'> </asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
The Grid View is populated this way:
public void TempTable()
{
DataTable dt = new DataTable();
dt.Columns.Add("ID", typeof(int));
dt.Columns.Add("Name", typeof(String));
dt.Columns.Add("Year", typeof(String));
dt.Columns.Add("Image", typeof(String));
Session["data"] = dt;
Temp = dt.Copy();
DataSet ds = GetData(query);
GridView3.DataSource = ds;
GridView3.DataBind();
}
DataSet GetData(String queryString)
{
string connectionString;
connectionString = WebConfigurationManager.ConnectionStrings["ConnectionString1"].ConnectionString;
DataSet ds = new DataSet();
try
{
SqlConnection Conn = new SqlConnection(connectionString);
SqlDataAdapter adapter = new SqlDataAdapter(queryString, connectionString);
adapter.Fill(ds);
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
return ds;
}
public DataTable Temp
{
get
{
object o = ViewState["Temp"];
if (o == null)
{
DataTable dt = new DataTable();
return dt;
}
else
return (DataTable)o;
}
set
{
ViewState["Temp"] = value;
}
}
And then I'm trying to sort this way:
private string ConvertSortDirectionToSql(SortDirection sortDirection)
{
string newSortDirection = String.Empty;
switch (sortDirection)
{
case SortDirection.Ascending:
newSortDirection = "ASC";
break;
case SortDirection.Descending:
newSortDirection = "DESC";
break;
}
return newSortDirection;
}
protected void GridView3_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView3.PageIndex = e.NewPageIndex;
GridView3.DataBind();
}
protected void GridView3_Sorting(object sender, GridViewSortEventArgs e)
{
DataTable dataTable = GridView3.DataSource as DataTable;
if (dataTable != null)
{
DataView dataView = new DataView(dataTable);
dataView.Sort = e.SortExpression + " " + ConvertSortDirectionToSql(e.SortDirection);
GridView3.DataSource = dataView;
GridView3.DataBind();
}
}
I think its because I'm using the temporary table, but dont know how to aply that here on sorting... Can you help me please?
|
|
|
|
|
I tried to work around this:
DataTable dataTable = Temp as DataTable;
if (dataTable != null)
{
DataView dataView = new DataView(dataTable);
dataView.Sort = e.SortExpression + " " + ConvertSortDirectionToSql(e.SortDirection);
Temp.AcceptChanges();
GridView3.DataSource = dataView;
GridView3.DataBind();
but it not working. When I try to sort, the GridView disappears.
I think I not seeing the way datatable works (or its not even necessary), so if anyone can give me an hint, I appreciate very much.
|
|
|
|
|
Have you done any sort of debugging ? What have you found ?
Why don't you use descriptive variable names ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: Have you done any sort of debugging ? What have you found ?
Why don't you use descriptive variable names ?
I have found nothing.. I forgot to present my exact problem: if I run with the code in first post, and I try to sort, it happens nothing. With the "solution" of my second post, when I sort the Gridview disappears.
What is exactly descriptive variable names? Can you give an example?
Rather Use
DataView dataView = dataTable.DefaultView
Maxdd 7 wrote:
Session["data"] = dt;
Why do you need Session to store datatable. .. D'Oh! D'Oh! D'Oh!
Also what exactly the problem is? Check Page_Load, if you have set DataSource and DataBind for every page postback.. You should filter out using if(IsPostBack)
Yes, in fact Session["data"] its nothing
My temp table is loaded this way:
if (!Page.IsPostback)
TempTable();
So I suppose I set DataSource and Databind just one time.. but its strange because if I do if(Page.Ispostback) my gridview does not appears...
Your advice, DataView dataView = dataTable.DefaultView, should I apply it in the code of my first post ( DataTable dataTable = GridView3.DataSource as DataTable; ) or the second one ? (DataTable dataTable = Temp as DataTable;) I tried with both but the problem still exists.. (first does not happen nothing, second disappear
Dont know else to do...
Thanks for your help!
modified on Tuesday, November 24, 2009 4:50 PM
|
|
|
|
|
Maxdd 7 wrote: What is exactly descriptive variable names? Can you give an example?
reportList as opposed to listView1.
Maxdd 7 wrote: So I suppose I set DataSource and Databind just one time.. but its strange because if I do if(Page.Ispostback) my gridview does not appears...
Are you using viewstate, or is it turned off ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: Are you using viewstate, or is it turned off ?
public DataTable Temp
{
get
{
object o = ViewState["Temp"];
if (o == null)
{
DataTable dt = new DataTable();
return dt;
}
else
return (DataTable)o;
}
set
{
ViewState["Temp"] = value;
}
}
Have I answered to your question? If not I'll try again.
|
|
|
|
|
This doesn't tell me if viewstate is turned on for the page or not. Have you set breakpoints to see if your data here is persisted or if it's lost ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|