|
Ah - add AutoGenerateColumns="false" to your grid view, by default it adds your templated columns AND generates one for each column in your data source.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi, thanks very much. Its working.
|
|
|
|
|
|
If this is a question then you're the stupidest person here, and that's some achievement. Turn off your PC, step away from it before you hurt yourself, and choose a new hobby/job.
Or, if you must persist, start by reading the forum guidelines, then move on to reading a book on ASP.NET, so you have some bloody idea of what is going on before you post such random drivel and expect us to solve it for you based entirely on magic ( you have an error, when does it happen, what does your code look like, what causes the error, you don't say, do you think we're psychic ? )
Sorry, I suffered fools more gladly when Microsoft gave me a reason to.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I'd love to know what that deleted message said. I need a laugh today
Regards
Julian Mummery
Please Visit my FREE Bug / Fault Logging Website at FaultLogger.com
|
|
|
|
|
Hi
Is there a way to get the item’s value that was just selected in a Checkboxlist?
I don’t what all the selected items.
Only the one that was just selected in my Checkboxlist before the postback
|
|
|
|
|
use
int i = convert.toint16(checkboxlist1.selectedvalue);
|
|
|
|
|
This only gives the first selected item in the Checkboxlist.
If two items are selected it will only look at the first item.
|
|
|
|
|
set multiple selection property true.
|
|
|
|
|
You can use javascript to keep track of last selected checkbox and put it in a hidden field.
On Postback, just get the value from that Hidden Field.
Hope this will help.
|
|
|
|
|
hi all
i have created a datatable with some columns.
then i added a report file and set the fields using datatable.
then i have taken a reportviewcontrol in my .aspx page
now i bind my report in runtime
everything is going fine but when the report is generated the value data drop field of report is one (but i datatable the value is more than one).
for coding please check the article :
http://www.aspfree.com/c/a/ASP.NET/Binding-Data-to-the-ReportViewer-Control-Dynamically-in-ASPNET-20
Er. Jagwinder Singh
|
|
|
|
|
Try this video about ReportViewer
http://download.microsoft.com/download/4/1/9/4191d186-e2a1-4b45-b4dd-b6364a4d5ced/14ReportViewer.zip
|
|
|
|
|
is it possible to display the checkboxes on the right side of a gridview when we use template field..
scarface
|
|
|
|
|
Yes, you can just go in gridview property and change order of columns.
|
|
|
|
|
i did check the properties of gridview but where is the ordering of the columns..
scarface
|
|
|
|
|
Go to .aspx page.In the gridview inside columns the column names alongwith it's properties are there.You just move that checkbox row to the last order.
|
|
|
|
|
well i did try dragging the checkbox column but thats not working..and i checked in the properties but there is no option for that..
scarface
|
|
|
|
|
what man u have to just move the checkbox column to the last order in aspx code.
say:<column 1:asd="" xmlns:1="#unknown"><column 2:sd="" xmlns:2="#unknown"><column 3:checkbox="" xmlns:3="#unknown">Like that order only u have to keep.
|
|
|
|
|
hey that message wasnt getting displayed..i tried in code..but there is no property as ordering of columns..am not getting as to where are you referring to change..
hey thanks for your help..
scarface
|
|
|
|
|
<Columns>
<asp:BoundField DataField="Country_ID" HeaderText="Country_ID" InsertVisible="False"
ReadOnly="True" SortExpression="Country_ID" />
<asp:BoundField DataField="Country_Name" HeaderText="Country_Name" SortExpression="Country_Name" />
<asp:BoundField DataField="Continent_ID" HeaderText="Continent_ID" SortExpression="Continent_ID" />
<asp:BoundField DataField="Continent_Name" HeaderText="Continent_Name" SortExpression="Continent_Name" />
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID ="df" runat ="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
just replace < and > with< and > resp and try.
|
|
|
|
|
i dint get this line < and > with < and > resp and try...
and am not using bound field..am having a gridview in which am using template field which has checkbox and am filling the data inside it with a datatable which is binded with the gridview..
scarface
|
|
|
|
|
|
here's my code..
<asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:TemplateField headertext="select">
<ItemTemplate>
<asp:CheckBox ID="chkbx" runat="server" /></ItemTemplate></asp:TemplateField></Columns>
</asp:GridView>
scarface
|
|
|
|
|
make the autogeneratecolumns="false" and add whatever columns u need in the columns section as boundfield or temp field watever u like.
|
|
|
|
|
this is my code:
protected void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
this.TextBox1.Text = System.DateTime.Now.ToShortDateString();
this.pnlCalendar.Attributes.Add("style", "DISPLAY: none; POSITION: absolute");
}
else
{
string id = Page.Request.Form["__EVENTTARGET"].Substring(0,Page.Request.Form["__EVENTTARGET"].IndexOf(":"));
if (id != this.ID)
{
this.pnlCalendar.Attributes.Add("style","DISPLAY: none; POSITION: absolute");
}
else
{
this.pnlCalendar.Attributes.Add("style","POSITION: absolute");
}
}
Page.RegisterClientScriptBlock("Script_Panel" + this.ID, " function On"+this.ID+"Click() { if("+this.ID+"_pnlCalendar.style.display == \"none\") "+this.ID+"_pnlCalendar.style.display = \"\"; else "+this.ID+"_pnlCalendar.style.display = \"none\"; } ");
this.Button1.Attributes.Add("OnClick","On"+this.ID+"Click()");
}
and for changing the date:
protected void Calendar1_SelectionChanged(object sender, System.EventArgs e)
{
this.TextBox1.Text = Calendar1.SelectedDate.ToShortDateString();
this.pnlCalendar.Attributes.Add("style", "DISPLAY: none; POSITION: absolute");
}
now iam getting the error as below :please can any one help me to run properly my code:
Length cannot be less than zero.
Parameter name: length
error is generated at this lines:
Source Error:
Line 23: else
Line 24: {
Line 25: string id = Page.Request.Form["__EVENTTARGET"].Substring(0,Page.Request.Form["__EVENTTARGET"].IndexOf(":"));
Line 26: if (id != this.ID)
Line 27: {
|
|
|
|